npc0 commited on
Commit
24dbd70
·
1 Parent(s): dbcbd54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -31,6 +31,7 @@ init_history = [
31
 
32
  』提議五個適合的公式。'''),
33
  ]
 
34
 
35
  os.system("wget https://huggingface.co/npc0/chatglm3-6b-int4/resolve/main/chatglm3-ggml-q4_0.bin")
36
 
@@ -98,7 +99,7 @@ def reset_user_input():
98
 
99
 
100
  def reset_state():
101
- history = gr.State(init_history)
102
  return '', '', [], gr.Dropdown.update(value=None, interactive=False)
103
 
104
 
@@ -122,7 +123,7 @@ with gr.Blocks() as demo:
122
  expand = gr.Dropdown(["1", "2", "3", "4", "5"], label="Step2:進一步擴展的範例", interactive=False)
123
  final_sample = gr.Textbox(show_label=False, placeholder="大綱")
124
 
125
- history = gr.State(init_history)
126
 
127
  submitBtn.click(
128
  predict,
 
31
 
32
  』提議五個適合的公式。'''),
33
  ]
34
+ INIT_LEN = len(init_history)
35
 
36
  os.system("wget https://huggingface.co/npc0/chatglm3-6b-int4/resolve/main/chatglm3-ggml-q4_0.bin")
37
 
 
99
 
100
 
101
  def reset_state():
102
+ history = history[:INIT_LEN]
103
  return '', '', [], gr.Dropdown.update(value=None, interactive=False)
104
 
105
 
 
123
  expand = gr.Dropdown(["1", "2", "3", "4", "5"], label="Step2:進一步擴展的範例", interactive=False)
124
  final_sample = gr.Textbox(show_label=False, placeholder="大綱")
125
 
126
+ history = init_history[:]
127
 
128
  submitBtn.click(
129
  predict,