Update app.py
Browse files
app.py
CHANGED
|
@@ -101,9 +101,14 @@ def process_image(image_input, unit):
|
|
| 101 |
|
| 102 |
return "正在分析..."
|
| 103 |
|
| 104 |
-
def
|
| 105 |
global result
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
def reset_result():
|
| 109 |
global result
|
|
@@ -124,7 +129,7 @@ with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
|
|
| 124 |
"整形美容科", "营养科", "生殖中心", "麻醉医学科", "医学影像科", \
|
| 125 |
"骨科", "肿瘤科", "急诊科", "检验科"])
|
| 126 |
with gr.Row():
|
| 127 |
-
output_box =
|
| 128 |
with gr.Row():
|
| 129 |
image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
|
| 130 |
text_input = gr.Textbox(label="输入") # Create a text input box
|
|
@@ -135,7 +140,8 @@ with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
|
|
| 135 |
gr.Markdown(LICENSE)
|
| 136 |
|
| 137 |
# Set up the event listeners
|
| 138 |
-
submit_btn.click(main, inputs=[text_input, image_input, unit], outputs=output_box).then(
|
|
|
|
| 139 |
|
| 140 |
|
| 141 |
|
|
|
|
| 101 |
|
| 102 |
return "正在分析..."
|
| 103 |
|
| 104 |
+
def output():
|
| 105 |
global result
|
| 106 |
+
print(result)
|
| 107 |
+
return gr.Markdown(value=result, label="分析")
|
| 108 |
+
|
| 109 |
+
def refresh():
|
| 110 |
+
time.sleep(30)
|
| 111 |
+
output()
|
| 112 |
|
| 113 |
def reset_result():
|
| 114 |
global result
|
|
|
|
| 129 |
"整形美容科", "营养科", "生殖中心", "麻醉医学科", "医学影像科", \
|
| 130 |
"骨科", "肿瘤科", "急诊科", "检验科"])
|
| 131 |
with gr.Row():
|
| 132 |
+
output_box = output()
|
| 133 |
with gr.Row():
|
| 134 |
image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
|
| 135 |
text_input = gr.Textbox(label="输入") # Create a text input box
|
|
|
|
| 140 |
gr.Markdown(LICENSE)
|
| 141 |
|
| 142 |
# Set up the event listeners
|
| 143 |
+
submit_btn.click(main, inputs=[text_input, image_input, unit], outputs=output_box).then(refresh)
|
| 144 |
+
|
| 145 |
|
| 146 |
|
| 147 |
|