Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ DESCRIPTION = '''
|
|
22 |
<p>🩺一个帮助您分析症状和检验报告的家庭医生(AI诊疗助手)。</p>
|
23 |
<p>🔎 选择您需要咨询的科室医生,在输入框中输入症状描述或者体检信息等;您也可以在图片框中上传检测报告图。</p>
|
24 |
<p>🦕 请注意生成信息可能不准确,且不具备任何实际参考价值,如有需要请联系专业医生。</p>
|
25 |
-
<p>💾
|
26 |
</div>
|
27 |
'''
|
28 |
|
@@ -85,9 +85,9 @@ def process_image(image_input, unit):
|
|
85 |
|
86 |
print(res0)
|
87 |
json_path = res0
|
88 |
-
|
89 |
def update():
|
90 |
-
result
|
91 |
job = client.submit(
|
92 |
json_path,
|
93 |
fn_index=1
|
@@ -97,8 +97,9 @@ def process_image(image_input, unit):
|
|
97 |
data = json.load(f)
|
98 |
print(data)
|
99 |
result = data[-1][1]
|
100 |
-
|
101 |
threading.Thread(target=update).start()
|
|
|
102 |
|
103 |
def fetch_result():
|
104 |
return result
|
@@ -108,6 +109,7 @@ def reset_result():
|
|
108 |
|
109 |
def main(text_input="", image_input=None, unit=""):
|
110 |
global result
|
|
|
111 |
if text_input and image_input is None:
|
112 |
process_text(text_input, unit)
|
113 |
elif image_input is not None:
|
@@ -129,8 +131,8 @@ with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
|
|
129 |
image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
|
130 |
text_input = gr.Textbox(label="输入") # Create a text input box
|
131 |
with gr.Row():
|
132 |
-
submit_btn = gr.Button("🚀
|
133 |
-
fresh_btn = gr.Button("✨
|
134 |
clear_btn = gr.ClearButton([output_box, image_input, text_input], value="🗑️ 清空") # Create a clear button
|
135 |
|
136 |
|
|
|
22 |
<p>🩺一个帮助您分析症状和检验报告的家庭医生(AI诊疗助手)。</p>
|
23 |
<p>🔎 选择您需要咨询的科室医生,在输入框中输入症状描述或者体检信息等;您也可以在图片框中上传检测报告图。</p>
|
24 |
<p>🦕 请注意生成信息可能不准确,且不具备任何实际参考价值,如有需要请联系专业医生。</p>
|
25 |
+
<p>💾 由于网络环境问题,如果长时间未出现分析内容,您可以点击重载,尝试获取结果。</p>
|
26 |
</div>
|
27 |
'''
|
28 |
|
|
|
85 |
|
86 |
print(res0)
|
87 |
json_path = res0
|
88 |
+
|
89 |
def update():
|
90 |
+
global result
|
91 |
job = client.submit(
|
92 |
json_path,
|
93 |
fn_index=1
|
|
|
97 |
data = json.load(f)
|
98 |
print(data)
|
99 |
result = data[-1][1]
|
100 |
+
result = "正在分析....."
|
101 |
threading.Thread(target=update).start()
|
102 |
+
|
103 |
|
104 |
def fetch_result():
|
105 |
return result
|
|
|
109 |
|
110 |
def main(text_input="", image_input=None, unit=""):
|
111 |
global result
|
112 |
+
reset_result()
|
113 |
if text_input and image_input is None:
|
114 |
process_text(text_input, unit)
|
115 |
elif image_input is not None:
|
|
|
131 |
image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
|
132 |
text_input = gr.Textbox(label="输入") # Create a text input box
|
133 |
with gr.Row():
|
134 |
+
submit_btn = gr.Button("🚀 发送") # Create a submit button
|
135 |
+
fresh_btn = gr.Button("✨ 重载")
|
136 |
clear_btn = gr.ClearButton([output_box, image_input, text_input], value="🗑️ 清空") # Create a clear button
|
137 |
|
138 |
|