Update app.py
Browse files
app.py
CHANGED
|
@@ -64,6 +64,8 @@ def chat_with_ai(user_input, chat_history):
|
|
| 64 |
|
| 65 |
return chat_history, ""
|
| 66 |
|
|
|
|
|
|
|
| 67 |
|
| 68 |
def gradio_chatbot():
|
| 69 |
with gr.Blocks() as demo:
|
|
@@ -81,6 +83,7 @@ def gradio_chatbot():
|
|
| 81 |
submit_button.click(chat_with_ai, inputs=[user_input, chat_history], outputs=[chatbot, user_input])
|
| 82 |
|
| 83 |
user_input.submit(chat_with_ai, inputs=[user_input, chat_history], outputs=[chatbot, user_input])
|
|
|
|
| 84 |
|
| 85 |
return demo
|
| 86 |
|
|
|
|
| 64 |
|
| 65 |
return chat_history, ""
|
| 66 |
|
| 67 |
+
def clear_history():
|
| 68 |
+
return [], ""
|
| 69 |
|
| 70 |
def gradio_chatbot():
|
| 71 |
with gr.Blocks() as demo:
|
|
|
|
| 83 |
submit_button.click(chat_with_ai, inputs=[user_input, chat_history], outputs=[chatbot, user_input])
|
| 84 |
|
| 85 |
user_input.submit(chat_with_ai, inputs=[user_input, chat_history], outputs=[chatbot, user_input])
|
| 86 |
+
btn_clear.click(fn=clear_history, outputs=[chatbot, user_input])
|
| 87 |
|
| 88 |
return demo
|
| 89 |
|