Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,17 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
def
|
| 4 |
reply = "You said: " + message
|
| 5 |
history = history + [[message, reply]]
|
| 6 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
-
demo = gr.ChatInterface(chat)
|
| 9 |
-
demo.queue()
|
| 10 |
demo.launch()
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
def chat_fn(message, history):
|
| 4 |
reply = "You said: " + message
|
| 5 |
history = history + [[message, reply]]
|
| 6 |
+
return "", history
|
| 7 |
+
|
| 8 |
+
with gr.Blocks() as demo:
|
| 9 |
+
chatbot = gr.Chatbot(height=450)
|
| 10 |
+
msg = gr.Textbox(placeholder="Type here...", label=None)
|
| 11 |
+
clear = gr.Button("Clear")
|
| 12 |
+
|
| 13 |
+
msg.submit(chat_fn, [msg, chatbot], [msg, chatbot])
|
| 14 |
+
clear.click(lambda: ("", []), None, [msg, chatbot])
|
| 15 |
|
|
|
|
|
|
|
| 16 |
demo.launch()
|
| 17 |
+
|