orrinin commited on
Commit
123c5d1
·
verified ·
1 Parent(s): 19ff6e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -101,9 +101,9 @@ def process_image(image_input, unit):
101
 
102
  return "等待分析..."
103
 
104
- def fetch_result():
105
- global result
106
  return result
 
107
  def reset_result():
108
  global result
109
  result = 0
@@ -123,7 +123,7 @@ with gr.Blocks(css=css, title="家庭医生AI助手") as iface:
123
  "整形美容科", "营养科", "生殖中心", "麻醉医学科", "医学影像科", \
124
  "骨科", "肿瘤科", "急诊科", "检验科"])
125
  with gr.Row():
126
- output_box = gr.Markdown(value=result, every=10, label="分析")
127
  with gr.Row():
128
  image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
129
  text_input = gr.Textbox(label="输入") # Create a text input box
@@ -135,7 +135,8 @@ with gr.Blocks(css=css, title="家庭医生AI助手") as iface:
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
 
 
101
 
102
  return "等待分析..."
103
 
104
+ def refresh():
 
105
  return result
106
+
107
  def reset_result():
108
  global result
109
  result = 0
 
123
  "整形美容科", "营养科", "生殖中心", "麻醉医学科", "医学影像科", \
124
  "骨科", "肿瘤科", "急诊科", "检验科"])
125
  with gr.Row():
126
+ output_box = gr.Markdown(value=result, label="分析")
127
  with gr.Row():
128
  image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
129
  text_input = gr.Textbox(label="输入") # Create a text input box
 
135
 
136
  # Set up the event listeners
137
  submit_btn.click(main, inputs=[text_input, image_input, unit], outputs=output_box)
138
+ submit_btn.click(refresh, every= 1000, outputs=output_box)
139
+
140
 
141
  #gr.close_all()
142