TejAndrewsACC commited on
Commit
877c07e
·
verified ·
1 Parent(s): d01df7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
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="Type something...")
39
- clear = gr.ClearButton([msg, chatbot])
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()