Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -31,12 +31,12 @@ def chatbot(message, history):
|
|
31 |
# Append the response to the history
|
32 |
history.append((message, response))
|
33 |
return history, ""
|
34 |
-
|
35 |
with gr.Blocks() as demo:
|
36 |
gr.Markdown("## Chatbot using Transformers")
|
37 |
|
38 |
# Create a Chatbot component
|
39 |
-
|
40 |
|
41 |
with gr.Row():
|
42 |
# Create a Textbox component for user input
|
@@ -46,7 +46,7 @@ with gr.Blocks() as demo:
|
|
46 |
)
|
47 |
|
48 |
# Attach the chatbot function to the Textbox component
|
49 |
-
txt.submit(chatbot, [txt,
|
50 |
|
51 |
# Launch the Gradio interface
|
52 |
demo.launch()
|
|
|
31 |
# Append the response to the history
|
32 |
history.append((message, response))
|
33 |
return history, ""
|
34 |
+
# Create the Gradio interface
|
35 |
with gr.Blocks() as demo:
|
36 |
gr.Markdown("## Chatbot using Transformers")
|
37 |
|
38 |
# Create a Chatbot component
|
39 |
+
chatbot_component = gr.Chatbot([], elem_id="chatbot")
|
40 |
|
41 |
with gr.Row():
|
42 |
# Create a Textbox component for user input
|
|
|
46 |
)
|
47 |
|
48 |
# Attach the chatbot function to the Textbox component
|
49 |
+
txt.submit(chatbot, [txt, chatbot_component], [chatbot_component, txt])
|
50 |
|
51 |
# Launch the Gradio interface
|
52 |
demo.launch()
|