orrinin commited on
Commit
e7b1c23
·
verified ·
1 Parent(s): e861ae5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -60,6 +60,7 @@ def process_text(text_input, unit):
60
  )
61
  response = job.result()
62
  local_data.results = response[1][0][1]
 
63
 
64
  def update(json_path: str):
65
  init_data()
@@ -101,7 +102,9 @@ def process_image(image_input, unit):
101
  print(res0)
102
  t = threading.Thread(target=update, args=(res0,))
103
  t.start()
104
- local_data.results = "正在分析....."
 
 
105
 
106
  def fetch_result():
107
  init_data()
@@ -113,13 +116,12 @@ def reset_result():
113
  local_data.results = ""
114
 
115
  def main(text_input="", image_input=None, unit=""):
116
- init_data()
117
  reset_result()
118
  if text_input and image_input is None:
119
- process_text(text_input, unit)
120
  elif image_input is not None:
121
- process_image(image_input, unit)
122
- return local_data.results
123
 
124
 
125
  with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface:
 
60
  )
61
  response = job.result()
62
  local_data.results = response[1][0][1]
63
+ return local_data.results
64
 
65
  def update(json_path: str):
66
  init_data()
 
102
  print(res0)
103
  t = threading.Thread(target=update, args=(res0,))
104
  t.start()
105
+ temp = "正在分析....."
106
+ t.join()
107
+ return temp
108
 
109
  def fetch_result():
110
  init_data()
 
116
  local_data.results = ""
117
 
118
  def main(text_input="", image_input=None, unit=""):
 
119
  reset_result()
120
  if text_input and image_input is None:
121
+ return process_text(text_input, unit)
122
  elif image_input is not None:
123
+ return process_image(image_input, unit)
124
+
125
 
126
 
127
  with gr.Blocks(css=css, title="家庭医生AI助手", theme="soft") as iface: