orrinin commited on
Commit
5a54d70
·
verified ·
1 Parent(s): 0135d36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -42,6 +42,7 @@ LICENSE = '当前采用 ' + MODEL_NAME + ' 模型,请主动移除个人信息
42
 
43
 
44
  local_data = threading.local()
 
45
  def init_data():
46
  if not hasattr(local_data, 'results'):
47
  local_data.results = ""
@@ -69,10 +70,11 @@ def update(json_path: str):
69
  response = job.result()
70
  with open(response, 'r') as f:
71
  data = json.load(f)
72
- local_data.results = data[-1][1]
 
73
 
74
 
75
- def process_image(image_input, unit, temp):
76
  init_data()
77
  if image_input is not None:
78
  image = str(image_input)
@@ -97,7 +99,7 @@ def process_image(image_input, unit, temp):
97
  )
98
 
99
  print(res0)
100
- t = threading.Thread(target=update, args=(res0))
101
  t.start()
102
  local_data.results = "正在分析....."
103
 
@@ -113,11 +115,10 @@ def reset_result():
113
  def main(text_input="", image_input=None, unit=""):
114
  init_data()
115
  reset_result()
116
- temp = ""
117
  if text_input and image_input is None:
118
  process_text(text_input, unit)
119
  elif image_input is not None:
120
- process_image(image_input, unit, temp)
121
  return local_data.results
122
 
123
 
 
42
 
43
 
44
  local_data = threading.local()
45
+
46
  def init_data():
47
  if not hasattr(local_data, 'results'):
48
  local_data.results = ""
 
70
  response = job.result()
71
  with open(response, 'r') as f:
72
  data = json.load(f)
73
+ local_data.results = data[-1][1]
74
+ print(local_data.results)
75
 
76
 
77
+ def process_image(image_input, unit):
78
  init_data()
79
  if image_input is not None:
80
  image = str(image_input)
 
99
  )
100
 
101
  print(res0)
102
+ t = threading.Thread(target=update, args=(res0,))
103
  t.start()
104
  local_data.results = "正在分析....."
105
 
 
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