Yaron Koresh commited on
Commit
0e5f0ad
·
verified ·
1 Parent(s): 8eabfee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -33,7 +33,7 @@ def init_pool():
33
  port_inc()
34
 
35
  def pipe_t2i():
36
- PIPE = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, token=os.getenv("hf_token"), device=-1)
37
  return PIPE
38
 
39
  def pipe_i2i():
@@ -161,6 +161,7 @@ function custom(){
161
  """
162
 
163
  def infer(p):
 
164
  p1 = p["a"]
165
  p2 = p["b"]
166
  name = generate_random_string(12)+".png"
@@ -192,9 +193,11 @@ def run(p1,p2,*result):
192
  p2_en = translate(p2,"english")
193
  p = {"a":p1_en,"b":p2_en}
194
  ln = len(result)
 
195
  rng = list(range(ln))
196
  arr = [p for _ in rng]
197
  out = None
 
198
  with Pool(ln, initializer=init_pool) as pool:
199
  out = pool.imap(infer,arr)
200
  return list(out)
 
33
  port_inc()
34
 
35
  def pipe_t2i():
36
+ PIPE = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16, token=os.getenv("hf_token"))
37
  return PIPE
38
 
39
  def pipe_i2i():
 
161
  """
162
 
163
  def infer(p):
164
+ print("infer: started")
165
  p1 = p["a"]
166
  p2 = p["b"]
167
  name = generate_random_string(12)+".png"
 
193
  p2_en = translate(p2,"english")
194
  p = {"a":p1_en,"b":p2_en}
195
  ln = len(result)
196
+ print("images: "+str(ln))
197
  rng = list(range(ln))
198
  arr = [p for _ in rng]
199
  out = None
200
+ ptint("Starting pool!")
201
  with Pool(ln, initializer=init_pool) as pool:
202
  out = pool.imap(infer,arr)
203
  return list(out)