orrinin commited on
Commit
2ef7963
·
verified ·
1 Parent(s): e6786ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -42,8 +42,9 @@ LICENSE = '当前采用 ' + MODEL_NAME + ' 模型,请主动移除个人信息
42
 
43
  local_data = threading.local()
44
  def init_data():
45
- local_data.results = ""
46
- local_data.json_path = ""
 
47
 
48
  def process_text(text_input, unit):
49
  init_data()
@@ -120,7 +121,6 @@ def main(text_input="", image_input=None, unit=""):
120
  return local_data.result
121
 
122
  with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
123
- init_data()
124
  with gr.Accordion(""):
125
  gr.Markdown(DESCRIPTION)
126
  unit = gr.Dropdown(label="🩺科室", value='中医科', elem_id="units",
@@ -130,7 +130,7 @@ with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
130
  "骨科", "肿瘤科", "急诊科", "检验科"])
131
 
132
  with gr.Row():
133
- output_box = gr.Markdown(label="分析")
134
  with gr.Row():
135
  image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
136
  text_input = gr.Textbox(label="输入") # Create a text input box
 
42
 
43
  local_data = threading.local()
44
  def init_data():
45
+ if not hasattr(thread_local_data, 'results') and not hasattr(thread_local_data, 'json_path'):
46
+ local_data.results = ""
47
+ local_data.json_path = ""
48
 
49
  def process_text(text_input, unit):
50
  init_data()
 
121
  return local_data.result
122
 
123
  with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
 
124
  with gr.Accordion(""):
125
  gr.Markdown(DESCRIPTION)
126
  unit = gr.Dropdown(label="🩺科室", value='中医科', elem_id="units",
 
130
  "骨科", "肿瘤科", "急诊科", "检验科"])
131
 
132
  with gr.Row():
133
+ output_box = gr.Textbox(label="分析")
134
  with gr.Row():
135
  image_input = gr.Image(type="filepath", label="上传图片") # Create an image upload button
136
  text_input = gr.Textbox(label="输入") # Create a text input box