Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -33,11 +33,16 @@ def chat_function(message, history):
|
|
33 |
except Exception as e:
|
34 |
return f"Error: {e}", history
|
35 |
|
|
|
|
|
|
|
|
|
36 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
37 |
chatbot = gr.Chatbot()
|
38 |
-
msg = gr.Textbox(placeholder="
|
39 |
-
clear = gr.
|
40 |
|
41 |
msg.submit(chat_function, [msg, chatbot], [msg, chatbot])
|
|
|
42 |
|
43 |
demo.launch()
|
|
|
33 |
except Exception as e:
|
34 |
return f"Error: {e}", history
|
35 |
|
36 |
+
def reset_context():
|
37 |
+
global context
|
38 |
+
context = "" # Reset the context
|
39 |
+
|
40 |
with gr.Blocks(theme=gr.themes.Glass()) as demo:
|
41 |
chatbot = gr.Chatbot()
|
42 |
+
msg = gr.Textbox(placeholder="Message Z3ta...")
|
43 |
+
clear = gr.Button("Clear")
|
44 |
|
45 |
msg.submit(chat_function, [msg, chatbot], [msg, chatbot])
|
46 |
+
clear.click(reset_context, [], [chatbot, msg]) # Clear chat and reset context
|
47 |
|
48 |
demo.launch()
|