Yaron Koresh commited on
Commit
ee2af0e
·
verified ·
1 Parent(s): 925f1f3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -193,13 +193,17 @@ def run(p1,p2,*result):
193
  out1 = None
194
  print("Starting pool!")
195
  with Pool(ln) as pool:
196
- out1 = pool.imap(infer1,arr1)
197
- lst = list(out1.get())
 
 
198
  arr2 = [{"a":p1_en,"b":p2_en,"c":lst[_]} for _ in rng]
199
  out2 = None
200
  with Pool(ln) as pool:
201
- out2 = pool.imap(infer2,arr2)
202
- return list(out2.get())
 
 
203
 
204
  def ui():
205
  with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo:
 
193
  out1 = None
194
  print("Starting pool!")
195
  with Pool(ln) as pool:
196
+ out1 = pool.map(infer1,arr1)
197
+ pool.join()
198
+ pool.close()
199
+ lst = list(out1)
200
  arr2 = [{"a":p1_en,"b":p2_en,"c":lst[_]} for _ in rng]
201
  out2 = None
202
  with Pool(ln) as pool:
203
+ out2 = pool.map(infer2,arr2)
204
+ pool.join()
205
+ pool.close()
206
+ return list(out2)
207
 
208
  def ui():
209
  with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo: