Yaron Koresh commited on
Commit
b2ed644
·
verified ·
1 Parent(s): 30d70d6

Update app.py

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