orrinin commited on
Commit
87291e9
·
verified ·
1 Parent(s): 428e9f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -103,9 +103,10 @@ def process_image(image_input, unit):
103
 
104
  def fetch_result():
105
  global result
106
- print(result)
107
  return result
108
-
 
 
109
 
110
  def main(text_input="", image_input=None, unit=""):
111
  if text_input and image_input is None:
@@ -129,11 +130,12 @@ with gr.Blocks(css=css, title="家庭医生AI助手") as iface:
129
  with gr.Row():
130
  submit_btn = gr.Button("🚀 确认") # Create a submit button
131
  clear_btn = gr.ClearButton([output_box, image_input, text_input], value="🗑️ 清空") # Create a clear button
 
132
  gr.Markdown(LICENSE)
133
 
134
  # Set up the event listeners
135
  submit_btn.click(main, inputs=[text_input, image_input, unit], outputs=output_box)
136
- output_box.change(fn=fetch_result,every=5)
137
 
138
  #gr.close_all()
139
 
 
103
 
104
  def fetch_result():
105
  global result
 
106
  return result
107
+ def reset_result():
108
+ global result
109
+ result = 0
110
 
111
  def main(text_input="", image_input=None, unit=""):
112
  if text_input and image_input is None:
 
130
  with gr.Row():
131
  submit_btn = gr.Button("🚀 确认") # Create a submit button
132
  clear_btn = gr.ClearButton([output_box, image_input, text_input], value="🗑️ 清空") # Create a clear button
133
+ clear_btn.click(fn=reset_result)
134
  gr.Markdown(LICENSE)
135
 
136
  # Set up the event listeners
137
  submit_btn.click(main, inputs=[text_input, image_input, unit], outputs=output_box)
138
+ output_box.change(fn=fetch_result,every=10)
139
 
140
  #gr.close_all()
141