akhaliq HF staff commited on
Commit
8eec998
1 Parent(s): 622cd3b

add support for iterative outputs

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +4 -4
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🧨
4
  colorFrom: blue
5
  colorTo: pink
6
  sdk: gradio
7
- sdk_version: 3.0.26
8
  app_file: app.py
9
  pinned: false
10
  ---
 
4
  colorFrom: blue
5
  colorTo: pink
6
  sdk: gradio
7
+ sdk_version: 3.2.1b0
8
  app_file: app.py
9
  pinned: false
10
  ---
app.py CHANGED
@@ -7,10 +7,10 @@ import numpy as np
7
 
8
  pipeline = LDMPipeline.from_pretrained("CompVis/ldm-celebahq-256")
9
 
10
- def predict(steps=1, seed=42):
11
  generator = torch.manual_seed(seed)
12
- images = pipeline(generator=generator, num_inference_steps=steps)["sample"]
13
- return images[0]
14
 
15
  random_seed = random.randint(0, 2147483647)
16
  gr.Interface(
@@ -23,4 +23,4 @@ gr.Interface(
23
  css="#output_image{width: 256px}",
24
  title="ldm-celebahq-256 - 🧨 diffusers library",
25
  description="This Spaces contains an unconditional Latent Diffusion process for the <a href=\"https://huggingface.co/CompVis/ldm-celebahq-256\">ldm-celebahq-256</a> face generator model by <a href=\"https://huggingface.co/CompVis\">CompVis</a> using the <a href=\"https://github.com/huggingface/diffusers\">diffusers library</a>. The goal of this demo is to showcase the diffusers library capabilities. If you want the state-of-the-art experience with Latent Diffusion text-to-image check out the <a href=\"https://huggingface.co/spaces/multimodalart/latentdiffusion\">main Spaces</a>.",
26
- ).launch()
 
7
 
8
  pipeline = LDMPipeline.from_pretrained("CompVis/ldm-celebahq-256")
9
 
10
+ def predict(steps, seed):
11
  generator = torch.manual_seed(seed)
12
+ for i in range(1,steps):
13
+ yield pipeline(generator=generator, num_inference_steps=i)["sample"][0]
14
 
15
  random_seed = random.randint(0, 2147483647)
16
  gr.Interface(
 
23
  css="#output_image{width: 256px}",
24
  title="ldm-celebahq-256 - 🧨 diffusers library",
25
  description="This Spaces contains an unconditional Latent Diffusion process for the <a href=\"https://huggingface.co/CompVis/ldm-celebahq-256\">ldm-celebahq-256</a> face generator model by <a href=\"https://huggingface.co/CompVis\">CompVis</a> using the <a href=\"https://github.com/huggingface/diffusers\">diffusers library</a>. The goal of this demo is to showcase the diffusers library capabilities. If you want the state-of-the-art experience with Latent Diffusion text-to-image check out the <a href=\"https://huggingface.co/spaces/multimodalart/latentdiffusion\">main Spaces</a>.",
26
+ ).queue().launch()