linoyts HF Staff commited on
Commit
abd3b00
verified
1 Parent(s): 9b6844a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -26,6 +26,17 @@ from modules.model_edit import Step1XParams, Step1XEdit
26
 
27
  print("TORCH_CUDA", torch.cuda.is_available())
28
 
 
 
 
 
 
 
 
 
 
 
 
29
  def load_state_dict(model, ckpt_path, device="cuda", strict=False, assign=True):
30
  if Path(ckpt_path).suffix == ".safetensors":
31
  state_dict = load_file(ckpt_path, device)
@@ -444,7 +455,7 @@ with gr.Blocks() as demo:
444
  with gr.Row():
445
  with gr.Column():
446
  prompt = gr.Textbox(
447
- label="缂栬緫鎸囦护",
448
  value='Remove the person from the image.',
449
  )
450
  init_image = gr.Image(label="Input Image", type='pil')
@@ -470,4 +481,12 @@ with gr.Blocks() as demo:
470
  outputs=[output_image, output_random_seed],
471
  )
472
 
 
 
 
 
 
 
 
 
473
  demo.launch()
 
26
 
27
  print("TORCH_CUDA", torch.cuda.is_available())
28
 
29
+ examples = [
30
+ ["examples 2/meme.jpg", "turn into an illustration in studio ghibli style",("examples 2/meme.jpg","examples 2/ghibli_meme.jpg"),],
31
+ ["examples 2/celeb_meme.jpg", "replace the gray blazer with a leather jacket",("examples 2/celeb_meme.jpg","examples 2/leather.jpg")],
32
+ ["examples 2/cookie.png", "remove the cookie",("examples 2/cookie.png","examples 2/no_cookie.png")],
33
+ ["examples 2/poster_orig.jpg", "replace 'lambs' with 'llamas'",("examples 2/poster_orig.jpg","examples 2/poster.jpg")],
34
+ ]
35
+
36
+ def generate_examples(init_image, output_image, prompt):
37
+ return init_image, output_image, prompt
38
+
39
+
40
  def load_state_dict(model, ckpt_path, device="cuda", strict=False, assign=True):
41
  if Path(ckpt_path).suffix == ".safetensors":
42
  state_dict = load_file(ckpt_path, device)
 
455
  with gr.Row():
456
  with gr.Column():
457
  prompt = gr.Textbox(
458
+ label="缂栬緫鎸囦护 prompt",
459
  value='Remove the person from the image.',
460
  )
461
  init_image = gr.Image(label="Input Image", type='pil')
 
481
  outputs=[output_image, output_random_seed],
482
  )
483
 
484
+ gr.Examples(
485
+ examples,
486
+ inputs=[init_image, prompt, output_image],
487
+ outputs=[init_image, prompt, output_image],
488
+ fn=generate_examples,
489
+ cache_examples=False
490
+ )
491
+
492
  demo.launch()