WonwoongCho commited on
Commit
dd55778
·
1 Parent(s): 84720c0

debugging app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -22,14 +22,14 @@ pipe = FluxPipeline.from_pretrained(
22
  pipe = pipe.to("cuda")
23
 
24
  @spaces.GPU
25
- def process_image_and_text(image, text, seed, pipeline):
26
  set_seed(seed)
27
  # image = Image.open(img_path).convert('RGB')
28
  image = resize_and_add_margin(image, target_size=512)
29
 
30
  image_list = [image]
31
-
32
- out = pipeline(
33
  prompt=text,
34
  height=512,
35
  width=512,
@@ -154,7 +154,7 @@ def create_app():
154
  filename="FLUX/it-blender.bin",
155
  token=token
156
  )
157
-
158
  pretrained_blended_attn_weights = torch.load(model_path, map_location=pipe._execution_device)
159
 
160
  key_changed_blended_attn_weights = {}
@@ -173,9 +173,8 @@ def create_app():
173
  label="Examples",
174
  )
175
 
176
- from functools import partial
177
  submit_btn.click(
178
- fn=partial(process_image_and_text, pipeline=pipe),
179
  inputs=[original_image, text, seed],
180
  outputs=output_image,
181
  )
@@ -185,4 +184,5 @@ def create_app():
185
 
186
  if __name__ == "__main__":
187
  demo = create_app()
188
- demo.launch(debug=True, ssr_mode=False)
 
 
22
  pipe = pipe.to("cuda")
23
 
24
  @spaces.GPU
25
+ def process_image_and_text(image, text, seed):
26
  set_seed(seed)
27
  # image = Image.open(img_path).convert('RGB')
28
  image = resize_and_add_margin(image, target_size=512)
29
 
30
  image_list = [image]
31
+
32
+ out = pipe(
33
  prompt=text,
34
  height=512,
35
  width=512,
 
154
  filename="FLUX/it-blender.bin",
155
  token=token
156
  )
157
+ print("pipe._execution_device",pipe._execution_device)
158
  pretrained_blended_attn_weights = torch.load(model_path, map_location=pipe._execution_device)
159
 
160
  key_changed_blended_attn_weights = {}
 
173
  label="Examples",
174
  )
175
 
 
176
  submit_btn.click(
177
+ fn=process_image_and_text,
178
  inputs=[original_image, text, seed],
179
  outputs=output_image,
180
  )
 
184
 
185
  if __name__ == "__main__":
186
  demo = create_app()
187
+ demo.launch(debug=True, ssr_mode=False, queue=False)
188
+ # demo.launch(debug=True, ssr_mode=False)