multimodalart HF staff commited on
Commit
099258b
1 Parent(s): b9509da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -18,6 +18,7 @@ pipe.enable_vae_tiling()
18
 
19
  # Apply hidiffusion with a single line of code.
20
  apply_hidiffusion(pipe)
 
21
 
22
  @spaces.GPU
23
  def run_hidiffusion(prompt, negative_prompt, progress=gr.Progress(track_tqdm=True)):
@@ -27,10 +28,9 @@ def run_hidiffusion(prompt, negative_prompt, progress=gr.Progress(track_tqdm=Tru
27
  def run_hidiffusion_15(prompt, negative_prompt, progress=gr.Progress(track_tqdm=True)):
28
  return pipe_15(prompt, guidance_scale=7.5, height=1024, width=1024, eta=1.0, negative_prompt=negative_prompt, num_inference_steps=25).images[0]
29
 
30
-
31
  with gr.Blocks() as demo:
32
  gr.Markdown("# HiDiffusion Demo")
33
- gr.Markdown("Make Stable Diffusion generated higher resolution images than what it was trained for")
34
  with gr.Tab("SDXL in 2048x2048"):
35
  with gr.Row():
36
  prompt = gr.Textbox(label="Prompt")
@@ -41,8 +41,12 @@ with gr.Blocks() as demo:
41
  prompt_15 = gr.Textbox(label="Prompt")
42
  negative_prompt_15 = gr.Textbox(label="Negative Prompt")
43
  btn_15 = gr.Button("Run")
44
- output = gr.Image()
45
-
 
 
 
 
46
  btn.click(fn=run_hidiffusion, inputs=[prompt, negative_prompt], outputs=[output])
47
  btn_15.click(fn=run_hidiffusion, inputs=[prompt_15, negative_prompt_15], outputs=[output])
48
  demo.launch()
 
18
 
19
  # Apply hidiffusion with a single line of code.
20
  apply_hidiffusion(pipe)
21
+ apply_hidiffusion(pipe_15)
22
 
23
  @spaces.GPU
24
  def run_hidiffusion(prompt, negative_prompt, progress=gr.Progress(track_tqdm=True)):
 
28
  def run_hidiffusion_15(prompt, negative_prompt, progress=gr.Progress(track_tqdm=True)):
29
  return pipe_15(prompt, guidance_scale=7.5, height=1024, width=1024, eta=1.0, negative_prompt=negative_prompt, num_inference_steps=25).images[0]
30
 
 
31
  with gr.Blocks() as demo:
32
  gr.Markdown("# HiDiffusion Demo")
33
+ gr.Markdown("Make diffusion models generate higher resolution images with Resolution-Aware U-Net & Multi-head Self-Attention. [Paper](https://huggingface.co/papers/2311.17528) | [Code](https://github.com/megvii-research/HiDiffusion)")
34
  with gr.Tab("SDXL in 2048x2048"):
35
  with gr.Row():
36
  prompt = gr.Textbox(label="Prompt")
 
41
  prompt_15 = gr.Textbox(label="Prompt")
42
  negative_prompt_15 = gr.Textbox(label="Negative Prompt")
43
  btn_15 = gr.Button("Run")
44
+ output = gr.Image(label="Result")
45
+ gr.Examples(examples=[
46
+ ["Echoes of a forgotten song drift across the moonlit sea, where a ghost ship sails, its spectral crew bound to an eternal quest for redemption.", ""],
47
+ ["Roger rabbit as a real person, photorealistic, cinematic.", ""],
48
+ ["tanding tall amidst the ruins, a stone golem awakens, vines and flowers sprouting from the crevices in its body.",""]
49
+ ], inputs=[prompt, negative_prompt], outputs=[output])
50
  btn.click(fn=run_hidiffusion, inputs=[prompt, negative_prompt], outputs=[output])
51
  btn_15.click(fn=run_hidiffusion, inputs=[prompt_15, negative_prompt_15], outputs=[output])
52
  demo.launch()