QL2023 commited on
Commit
8407d4e
·
verified ·
1 Parent(s): 3f0c66f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -2
app.py CHANGED
@@ -6,6 +6,10 @@ address = os.getenv("address")
6
 
7
  thread = 0
8
 
 
 
 
 
9
  def chat_history(message,history):
10
 
11
  global thread
@@ -19,7 +23,7 @@ def chat_history(message,history):
19
 
20
  return response['result']
21
 
22
- gr.ChatInterface(
23
  chat_history,
24
  chatbot=gr.Chatbot(),
25
  title="Grade Analyst",
@@ -29,4 +33,10 @@ gr.ChatInterface(
29
  retry_btn=None,
30
  undo_btn=None,
31
  clear_btn="Clear",
32
- ).launch()
 
 
 
 
 
 
 
6
 
7
  thread = 0
8
 
9
+ def reset():
10
+ global thread
11
+ thread = 0
12
+
13
  def chat_history(message,history):
14
 
15
  global thread
 
23
 
24
  return response['result']
25
 
26
+ chat = gr.ChatInterface(
27
  chat_history,
28
  chatbot=gr.Chatbot(),
29
  title="Grade Analyst",
 
33
  retry_btn=None,
34
  undo_btn=None,
35
  clear_btn="Clear",
36
+ )
37
+
38
+ with gr.Blocks() as demo:
39
+ chat.render()
40
+ gr.Button("Reset").click(reset)
41
+
42
+ demo.launch()