linoyts HF Staff commited on
Commit
a25cc60
·
verified ·
1 Parent(s): 6fda490

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -6
app.py CHANGED
@@ -239,9 +239,19 @@ pipe = QwenImageEditPlusPipeline.from_pretrained("Qwen/Qwen-Image-Edit-2511",
239
  torch_dtype=dtype).to(device)
240
  pipe.load_lora_weights(
241
  "lightx2v/Qwen-Image-Edit-2511-Lightning",
242
- weight_name="Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors"
243
  )
244
- pipe.fuse_lora()
 
 
 
 
 
 
 
 
 
 
245
 
246
  # # Apply the same optimizations from the first version
247
  # pipe.transformer.__class__ = QwenImageTransformer2DModel
@@ -253,6 +263,15 @@ pipe.fuse_lora()
253
  # --- UI Constants and Helpers ---
254
  MAX_SEED = np.iinfo(np.int32).max
255
 
 
 
 
 
 
 
 
 
 
256
  def use_output_as_input(output_images):
257
  """Convert output images to input format for the gallery"""
258
  if output_images is None or len(output_images) == 0:
@@ -388,11 +407,11 @@ with gr.Blocks(css=css) as demo:
388
  with gr.Row():
389
  prompt = gr.Text(
390
  label="Prompt",
 
391
  show_label=False,
392
- placeholder="describe the edit instruction",
393
- container=False,
394
  )
395
- run_button = gr.Button("Edit!", variant="primary")
396
 
397
  with gr.Accordion("Advanced Settings", open=False):
398
  # Negative prompt UI element is removed here
@@ -442,7 +461,7 @@ with gr.Blocks(css=css) as demo:
442
  )
443
 
444
 
445
- rewrite_prompt = gr.Checkbox(label="Rewrite prompt", value=True)
446
 
447
  # gr.Examples(examples=examples, inputs=[prompt], outputs=[result, seed], fn=infer, cache_examples=False)
448
 
 
239
  torch_dtype=dtype).to(device)
240
  pipe.load_lora_weights(
241
  "lightx2v/Qwen-Image-Edit-2511-Lightning",
242
+ weight_name="Qwen-Image-Edit-2511-Lightning-4steps-V1.0-bf16.safetensors",adapter_name="fast"
243
  )
244
+ pipe.load_lora_weights(
245
+ "lilylilith/AnyPose",
246
+ weight_name="2511-AnyPose-base-000006250.safetensors",adapter_name="base"
247
+ )
248
+ pipe.load_lora_weights(
249
+ "lilylilith/AnyPose",
250
+ weight_name="2511-AnyPose-helper-00006000.safetensors",adapter_name="helper"
251
+ )
252
+ pipe.set_adapters(["fast", "base", "helper"], adapter_weights=[1., 0.7, 0.7])
253
+ pipe.fuse_lora(adapter_names=["fast", "base", "helper"], lora_scale=1)
254
+ pipe.unload_lora_weights()
255
 
256
  # # Apply the same optimizations from the first version
257
  # pipe.transformer.__class__ = QwenImageTransformer2DModel
 
263
  # --- UI Constants and Helpers ---
264
  MAX_SEED = np.iinfo(np.int32).max
265
 
266
+ DEFAULT_LORA_PROMPT = """
267
+ Make the person in image 1 do the exact same pose of the person in image 2.
268
+ Changing the style and background of the image of the person in image 1 is undesirable, so don't do it.
269
+ The new pose should be pixel accurate to the pose we are trying to copy.
270
+ The position of the arms and head and legs should be the same as the pose we are trying to copy.
271
+ Change the field of view and angle to match exactly image 2. Head tilt and eye gaze pose should match the person in image 2.
272
+ Remove the background of image 2, and replace it with the background of image 1.
273
+ """
274
+
275
  def use_output_as_input(output_images):
276
  """Convert output images to input format for the gallery"""
277
  if output_images is None or len(output_images) == 0:
 
407
  with gr.Row():
408
  prompt = gr.Text(
409
  label="Prompt",
410
+ value=DEFAULT_LORA_PROMPT,
411
  show_label=False,
412
+ visible=False
 
413
  )
414
+ run_button = gr.Button("Edit Pose", variant="primary")
415
 
416
  with gr.Accordion("Advanced Settings", open=False):
417
  # Negative prompt UI element is removed here
 
461
  )
462
 
463
 
464
+ rewrite_prompt = gr.Checkbox(label="Rewrite prompt", value=False, visible=False)
465
 
466
  # gr.Examples(examples=examples, inputs=[prompt], outputs=[result, seed], fn=infer, cache_examples=False)
467