Yaron Koresh commited on
Commit
560ff39
·
verified ·
1 Parent(s): ea1a726

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
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(p1,p2):
222
-
223
  print(f'Starting!')
224
- v = infer(p1,p2)
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
- p1s = [p1_en for _ in rng]
236
- p2s = [p2_en for _ in rng]
237
  pool = Pool(processes=ln)
238
- lst = list( pool.map( _ret, p1s, p2s ) )
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