witcherderivia commited on
Commit
1ce6946
·
verified ·
1 Parent(s): cda3478

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -3
app.py CHANGED
@@ -20,7 +20,7 @@ def update_textbox(selected_items):
20
  return ", ".join(selected_items)
21
 
22
 
23
- pipe = QwenImageEditPlusPipeline.from_pretrained("Qwen/Qwen-Image-Edit-2509", torch_dtype=torch.bfloat16)
24
  print("pipeline loaded")
25
 
26
  pipe.to('cuda')
@@ -50,8 +50,8 @@ pipe = QwenImagePipeline.from_pretrained(
50
 
51
 
52
 
53
- qwenstyle= hf_hub_download(repo_id="Tele-AI/TeleStyleV2", filename="diffusers-TeleStyleV2-QIE-2509-Lora-bf16.safetensors")
54
- speedup = hf_hub_download(repo_id="Tele-AI/TeleStyleV2", filename="QIE-2509-Lightning-4steps-V1.0-bf16.safetensors")
55
 
56
 
57
 
@@ -223,6 +223,21 @@ def infer(
223
  sw=minedge
224
  sh=int(sw*r)-int(sw*r)%16
225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
 
227
 
228
 
@@ -258,6 +273,10 @@ def infer(
258
  prompt=prompt.replace(style_prompt.strip(),'')
259
  prompt=prompt.strip(',')
260
  print(f"Calling pipeline with prompt: '{prompt}'")
 
 
 
 
261
  inputs = {
262
  "image": images,
263
  "prompt": prompt,
 
20
  return ", ".join(selected_items)
21
 
22
 
23
+ pipe = QwenImageEditPlusPipeline.from_pretrained("Qwen/Qwen-Image-Edit-2511", torch_dtype=torch.bfloat16)
24
  print("pipeline loaded")
25
 
26
  pipe.to('cuda')
 
50
 
51
 
52
 
53
+ qwenstyle= hf_hub_download(repo_id="witcherderivia/PromptRoute/diffusers_promptroute_qie2511_bf16.safetensors", filename="diffusers-TeleStyleV2-QIE-2509-Lora-bf16.safetensors")
54
+ speedup = hf_hub_download(repo_id="Tele-AI/TeleStyleV2", filename="QIE-2511-Lightning-4steps-V1.0-bf16.safetensors")
55
 
56
 
57
 
 
223
  sw=minedge
224
  sh=int(sw*r)-int(sw*r)%16
225
 
226
+ if "Compose the pictures" in prompt:
227
+
228
+ #minedge=1024
229
+ if content_ref:
230
+ w,h=content_ref.size
231
+ r=w/h
232
+ h=minedge
233
+ w=int(h*r)-int(h*r)%16
234
+ #content_ref=content_ref.resize((w,h))
235
+ #minedge=1024
236
+ if style_ref:
237
+ sw,sh=style_ref.size
238
+ r=sw/sh
239
+ sh=minedge
240
+ sw=int(sh*r)-int(sh*r)%16
241
 
242
 
243
 
 
273
  prompt=prompt.replace(style_prompt.strip(),'')
274
  prompt=prompt.strip(',')
275
  print(f"Calling pipeline with prompt: '{prompt}'")
276
+ if "Compose the pictures" in prompt:
277
+ w=int(16/9*minedge)
278
+ w=w-w%16
279
+ h=minedge
280
  inputs = {
281
  "image": images,
282
  "prompt": prompt,