orrinin commited on
Commit
8a3a9e0
·
verified ·
1 Parent(s): 31a5408

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -40,7 +40,7 @@ footer {
40
  LICENSE = '采用 ' + MODEL_NAME + ' 模型'
41
 
42
 
43
- result = "等待分析..."
44
  json_path = ""
45
 
46
  def process_text(text_input, unit):
@@ -86,6 +86,7 @@ def process_image(image_input, unit):
86
  json_path = res0
87
 
88
  def update():
 
89
  job = client.submit(
90
  json_path,
91
  fn_index=1
@@ -101,7 +102,6 @@ def process_image(image_input, unit):
101
  return "等待分析..."
102
 
103
  def fetch_result():
104
- global result
105
  return result
106
 
107
 
@@ -120,17 +120,17 @@ with gr.Blocks(css=css, title="家庭医生AI助手") as iface:
120
  "整形美容科", "营养科", "生殖中心", "麻醉医学科", "医学影像科", \
121
  "骨科", "肿瘤科", "急诊科", "检验科"])
122
  with gr.Row():
123
- output_box = gr.Markdown(value=result, every=1, label="分析")
124
  with gr.Row():
125
  image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
126
  text_input = gr.Textbox(label="输入") # Create a text input box
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))
134
  gr.Markdown(LICENSE)
135
 
136
  #gr.close_all()
 
40
  LICENSE = '采用 ' + MODEL_NAME + ' 模型'
41
 
42
 
43
+ result = ""
44
  json_path = ""
45
 
46
  def process_text(text_input, unit):
 
86
  json_path = res0
87
 
88
  def update():
89
+ result = "正在分析..."
90
  job = client.submit(
91
  json_path,
92
  fn_index=1
 
102
  return "等待分析..."
103
 
104
  def fetch_result():
 
105
  return result
106
 
107
 
 
120
  "整形美容科", "营养科", "生殖中心", "麻醉医学科", "医学影像科", \
121
  "骨科", "肿瘤科", "急诊科", "检验科"])
122
  with gr.Row():
123
+ output_box = gr.Markdown(value=result, label="分析")
124
  with gr.Row():
125
  image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
126
  text_input = gr.Textbox(label="输入") # Create a text input box
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()