orrinin commited on
Commit
428e9f5
·
verified ·
1 Parent(s): 8a3a9e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -91,7 +91,7 @@ def process_image(image_input, unit):
91
  json_path,
92
  fn_index=1
93
  )
94
- response = job.result(timeout=60)
95
  with open(response, 'r') as f:
96
  data = json.load(f)
97
  print(data)
@@ -102,6 +102,8 @@ def process_image(image_input, unit):
102
  return "等待分析..."
103
 
104
  def fetch_result():
 
 
105
  return result
106
 
107
 
@@ -127,11 +129,11 @@ with gr.Blocks(css=css, title="家庭医生AI助手") as iface:
127
  with gr.Row():
128
  submit_btn = gr.Button("🚀 确认") # Create a submit button
129
  clear_btn = gr.ClearButton([output_box, image_input, text_input], value="🗑️ 清空") # Create a clear button
130
-
131
 
132
  # Set up the event listeners
133
- submit_btn.click(main, inputs=[text_input, image_input, unit], outputs=output_box).then(output_box.change(fn=fetch_result,every=1))
134
- gr.Markdown(LICENSE)
135
 
136
  #gr.close_all()
137
 
 
91
  json_path,
92
  fn_index=1
93
  )
94
+ response = job.result()
95
  with open(response, 'r') as f:
96
  data = json.load(f)
97
  print(data)
 
102
  return "等待分析..."
103
 
104
  def fetch_result():
105
+ global result
106
+ print(result)
107
  return result
108
 
109
 
 
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