linoyts HF Staff commited on
Commit
924c461
·
verified ·
1 Parent(s): fae5064

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -3
app.py CHANGED
@@ -279,7 +279,7 @@ def use_output_as_input(output_images):
279
  return None
280
  return output_images[0]
281
 
282
- # --- Main Inference Function (with hardcoded negative prompt) ---
283
  @spaces.GPU()
284
  def infer(
285
  reference_image,
@@ -378,6 +378,30 @@ def infer(
378
  # Return images, seed, and make button visible
379
  return image, seed, gr.update(visible=False)
380
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  # --- Examples and UI Layout ---
382
  examples = []
383
 
@@ -486,8 +510,8 @@ with gr.Blocks(css=css, theme=gr.themes.Citrus()) as demo:
486
  reference_image,
487
  pose_image,
488
  ],
489
- outputs=[result, seed, use_output_btn],
490
- fn=infer,
491
  cache_examples=True,
492
  cache_mode="lazy",
493
  )
 
279
  return None
280
  return output_images[0]
281
 
282
+
283
  @spaces.GPU()
284
  def infer(
285
  reference_image,
 
378
  # Return images, seed, and make button visible
379
  return image, seed, gr.update(visible=False)
380
 
381
+
382
+
383
+ def infer_for_examples(
384
+ reference_image,
385
+ pose_image,
386
+ prompt=DEFAULT_LORA_PROMPT,
387
+ seed=42,
388
+ randomize_seed=False,
389
+ true_guidance_scale=1.0,
390
+ num_inference_steps=4,
391
+ height=None,
392
+ width=None,
393
+ rewrite_prompt=False,
394
+ num_images_per_prompt=1,
395
+ progress=gr.Progress(track_tqdm=True),
396
+ ):
397
+ """Wrapper for examples that only returns image and seed."""
398
+ image, seed, _ = infer(
399
+ reference_image, pose_image, prompt, seed, randomize_seed,
400
+ true_guidance_scale, num_inference_steps, height, width,
401
+ rewrite_prompt, num_images_per_prompt, progress
402
+ )
403
+ return image, seed
404
+
405
  # --- Examples and UI Layout ---
406
  examples = []
407
 
 
510
  reference_image,
511
  pose_image,
512
  ],
513
+ outputs=[result, seed],
514
+ fn=infer_for_examples,
515
  cache_examples=True,
516
  cache_mode="lazy",
517
  )