Hi, I am new to dash.I want to create a chatbot using dash.
I tried like below
app.layout = html.Div([
dcc.Input(id=‘my-id’, value=‘Type your message here’, type=‘text’),
html.Button(‘send’,id=‘button’, type=‘submit’),
html.Div(id=‘my-div’)
])
@app.callback(
Output(component_id=‘my-div’, component_property=‘children’),
#[Input(component_id=‘my-id’, component_property=‘value’)]
[Input(‘button’, ‘n_clicks’)],
state=[State(component_id=‘my-id’, component_property=‘value’)]
)
def update_output_div(n_clicks,input_value):
response = " "
#input_value_list=input_value
invalid = "sorry,I could not understand your message."
for i in range(0, len(userList)):
input_v= input_value
input_v_reg = re.sub('[^A-Za-z0-9]', " ", input_v.lower())
input_v_reg_split = ( input_v_reg.split())
ud_v= str(userList[i]).lower()
ud_v = re.sub('[^A-Za-z0-9]', " ", ud_v)
new_list = ud_v.split()
common_words = [x for x in new_list if x in input_v_reg_split]
if len(common_words) == len(new_list):
response = cbList[i]
elif user=="":
response=invalid
return 'chatbot: {}'.format(response,n_clicks,user)
if name == ‘main’:
app.run_server(debug=True)
where userList is the user defind text and cbList is the response from chatbot.Now i want to store the input values from textbox to python variable,how to create that? and how do i create chatbot look in dash?