Yaron Koresh commited on
Commit
fb310d3
·
verified ·
1 Parent(s): 11aa020

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -29,10 +29,6 @@ def port_inc():
29
  else:
30
  os.environ["CUSTOM_PORT"]=str(int(env)+1)
31
 
32
- def init_pool():
33
- #port_inc()
34
- print("init pool")
35
-
36
  def pipe_t2i():
37
  PIPE = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, token=os.getenv("hf_token")).to("cuda")
38
  return PIPE
@@ -193,9 +189,9 @@ def run(p1,p2,*result):
193
  arr = [p for _ in rng]
194
  out = None
195
  print("Starting pool!")
196
- with Pool(ln, initializer=init_pool) as pool:
197
- out = pool.imap(infer,arr)
198
- return list(out)
199
 
200
  def ui():
201
  with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo:
 
29
  else:
30
  os.environ["CUSTOM_PORT"]=str(int(env)+1)
31
 
 
 
 
 
32
  def pipe_t2i():
33
  PIPE = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, token=os.getenv("hf_token")).to("cuda")
34
  return PIPE
 
189
  arr = [p for _ in rng]
190
  out = None
191
  print("Starting pool!")
192
+ with Pool(ln) as pool:
193
+ out = pool.map(infer,arr)
194
+ return list(out.get())
195
 
196
  def ui():
197
  with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo: