Update app.py
Browse files
app.py
CHANGED
@@ -62,6 +62,7 @@ def process_text(text_input, unit):
|
|
62 |
local_data.results = response[1][0][1]
|
63 |
return local_data.results
|
64 |
|
|
|
65 |
def update(json_path: str, event: threading.Event):
|
66 |
init_data()
|
67 |
event.wait()
|
@@ -74,6 +75,8 @@ def update(json_path: str, event: threading.Event):
|
|
74 |
data = json.load(f)
|
75 |
local_data.results = data[-1][1]
|
76 |
print(local_data.results)
|
|
|
|
|
77 |
|
78 |
|
79 |
def process_image(image_input, unit):
|
@@ -101,11 +104,21 @@ def process_image(image_input, unit):
|
|
101 |
)
|
102 |
|
103 |
print(res0)
|
|
|
104 |
event = threading.Event()
|
105 |
t = threading.Thread(target=update, args=(res0, event))
|
106 |
t.start()
|
107 |
local_data.results = "正在分析....."
|
108 |
-
event.set()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
return local_data.results
|
110 |
|
111 |
def fetch_result():
|
|
|
62 |
local_data.results = response[1][0][1]
|
63 |
return local_data.results
|
64 |
|
65 |
+
'''
|
66 |
def update(json_path: str, event: threading.Event):
|
67 |
init_data()
|
68 |
event.wait()
|
|
|
75 |
data = json.load(f)
|
76 |
local_data.results = data[-1][1]
|
77 |
print(local_data.results)
|
78 |
+
'''
|
79 |
+
|
80 |
|
81 |
|
82 |
def process_image(image_input, unit):
|
|
|
104 |
)
|
105 |
|
106 |
print(res0)
|
107 |
+
'''
|
108 |
event = threading.Event()
|
109 |
t = threading.Thread(target=update, args=(res0, event))
|
110 |
t.start()
|
111 |
local_data.results = "正在分析....."
|
112 |
+
event.set()
|
113 |
+
'''
|
114 |
+
job = client.submit(
|
115 |
+
res0,
|
116 |
+
fn_index=1
|
117 |
+
)
|
118 |
+
response = job.result()
|
119 |
+
with open(response, 'r') as f:
|
120 |
+
data = json.load(f)
|
121 |
+
local_data.results = data[-1][1]
|
122 |
return local_data.results
|
123 |
|
124 |
def fetch_result():
|