Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -218,10 +218,10 @@ with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo:
|
|
218 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
219 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
220 |
|
221 |
-
def _ret(
|
222 |
-
|
223 |
print(f'Starting!')
|
224 |
-
v = infer(
|
225 |
print(f'Finished!')
|
226 |
return v
|
227 |
|
@@ -229,13 +229,14 @@ with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo:
|
|
229 |
|
230 |
p1_en = translate(p1,"english")
|
231 |
p2_en = translate(p2,"english")
|
232 |
-
|
|
|
|
|
233 |
ln = len(result)
|
234 |
rng = range(ln)
|
235 |
-
|
236 |
-
p2s = [p2_en for _ in rng]
|
237 |
pool = Pool(processes=ln)
|
238 |
-
lst = list( pool.
|
239 |
pool.clear()
|
240 |
return lst
|
241 |
|
|
|
218 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
219 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
220 |
|
221 |
+
def _ret(p):
|
222 |
+
|
223 |
print(f'Starting!')
|
224 |
+
v = infer(p["a"],p["b"])
|
225 |
print(f'Finished!')
|
226 |
return v
|
227 |
|
|
|
229 |
|
230 |
p1_en = translate(p1,"english")
|
231 |
p2_en = translate(p2,"english")
|
232 |
+
|
233 |
+
p = {"a":p1_en,"b":p2_en}
|
234 |
+
|
235 |
ln = len(result)
|
236 |
rng = range(ln)
|
237 |
+
p_arr = [p for _ in rng]
|
|
|
238 |
pool = Pool(processes=ln)
|
239 |
+
lst = list( pool.imap( _ret, p_arr ) )
|
240 |
pool.clear()
|
241 |
return lst
|
242 |
|