Update app.py
Browse files
app.py
CHANGED
@@ -99,25 +99,19 @@ def process_image(image_input, unit):
|
|
99 |
|
100 |
threading.Thread(target=update).start()
|
101 |
|
102 |
-
return
|
103 |
|
104 |
-
def output():
|
105 |
-
return gr.Markdown(value=result, label="分析")
|
106 |
-
|
107 |
-
def refresh():
|
108 |
-
global result
|
109 |
-
time.sleep(20)
|
110 |
-
return result
|
111 |
|
112 |
def reset_result():
|
113 |
-
global result
|
114 |
result = 0
|
115 |
|
116 |
def main(text_input="", image_input=None, unit=""):
|
|
|
117 |
if text_input and image_input is None:
|
118 |
-
|
119 |
elif image_input is not None:
|
120 |
-
|
|
|
121 |
|
122 |
with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
|
123 |
with gr.Accordion(""):
|
@@ -127,8 +121,9 @@ with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
|
|
127 |
"五官科", "男科", "皮肤性病科", "传染科", "精神心理科", \
|
128 |
"整形美容科", "营养科", "生殖中心", "麻醉医学科", "医学影像科", \
|
129 |
"骨科", "肿瘤科", "急诊科", "检验科"])
|
|
|
130 |
with gr.Row():
|
131 |
-
output_box = gr.Markdown(label="分析")
|
132 |
with gr.Row():
|
133 |
image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
|
134 |
text_input = gr.Textbox(label="输入") # Create a text input box
|
@@ -136,12 +131,12 @@ with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
|
|
136 |
submit_btn = gr.Button("🚀 确认") # Create a submit button
|
137 |
clear_btn = gr.ClearButton([output_box, image_input, text_input], value="🗑️ 清空") # Create a clear button
|
138 |
clear_btn.click(fn=reset_result)
|
139 |
-
|
140 |
-
|
141 |
# Set up the event listeners
|
142 |
submit_btn.click(main, inputs=[text_input, image_input, unit], outputs=output_box)
|
143 |
-
|
144 |
|
|
|
145 |
|
146 |
|
147 |
|
|
|
99 |
|
100 |
threading.Thread(target=update).start()
|
101 |
|
102 |
+
return result
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
def reset_result():
|
|
|
106 |
result = 0
|
107 |
|
108 |
def main(text_input="", image_input=None, unit=""):
|
109 |
+
global result
|
110 |
if text_input and image_input is None:
|
111 |
+
process_text(text_input, unit)
|
112 |
elif image_input is not None:
|
113 |
+
process_image(image_input, unit)
|
114 |
+
|
115 |
|
116 |
with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
|
117 |
with gr.Accordion(""):
|
|
|
121 |
"五官科", "男科", "皮肤性病科", "传染科", "精神心理科", \
|
122 |
"整形美容科", "营养科", "生殖中心", "麻醉医学科", "医学影像科", \
|
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
|
|
|
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 |
+
|
|
|
135 |
# Set up the event listeners
|
136 |
submit_btn.click(main, inputs=[text_input, image_input, unit], outputs=output_box)
|
137 |
+
|
138 |
|
139 |
+
gr.Markdown(LICENSE)
|
140 |
|
141 |
|
142 |
|