Spaces:
Runtime error
Runtime error
Commit
•
4b1061b
1
Parent(s):
8ad58ba
Update in line with the other spaces
Browse files
app.py
CHANGED
@@ -2,10 +2,10 @@ from diffusers import LatentDiffusionUncondPipeline
|
|
2 |
import torch
|
3 |
import PIL.Image
|
4 |
import gradio as gr
|
|
|
5 |
import numpy as np
|
6 |
|
7 |
-
pipeline = LatentDiffusionUncondPipeline.from_pretrained("CompVis/
|
8 |
-
|
9 |
|
10 |
def predict(steps=1, seed=42):
|
11 |
generator = torch.manual_seed(seed)
|
@@ -14,12 +14,16 @@ def predict(steps=1, seed=42):
|
|
14 |
image_processed = (image_processed + 1.0) * 127.5
|
15 |
image_processed = image_processed.clamp(0, 255).numpy().astype(np.uint8)
|
16 |
return PIL.Image.fromarray(image_processed[0])
|
17 |
-
|
|
|
18 |
gr.Interface(
|
19 |
predict,
|
20 |
inputs=[
|
21 |
-
gr.inputs.Slider(1,
|
22 |
-
gr.inputs.Slider(0,
|
23 |
],
|
24 |
-
outputs="
|
|
|
|
|
|
|
25 |
).launch()
|
|
|
2 |
import torch
|
3 |
import PIL.Image
|
4 |
import gradio as gr
|
5 |
+
import random
|
6 |
import numpy as np
|
7 |
|
8 |
+
pipeline = LatentDiffusionUncondPipeline.from_pretrained("CompVis/ldm-celebahq-256")
|
|
|
9 |
|
10 |
def predict(steps=1, seed=42):
|
11 |
generator = torch.manual_seed(seed)
|
|
|
14 |
image_processed = (image_processed + 1.0) * 127.5
|
15 |
image_processed = image_processed.clamp(0, 255).numpy().astype(np.uint8)
|
16 |
return PIL.Image.fromarray(image_processed[0])
|
17 |
+
|
18 |
+
random_seed = random.randint(0, 2147483647)
|
19 |
gr.Interface(
|
20 |
predict,
|
21 |
inputs=[
|
22 |
+
gr.inputs.Slider(1, 100, label='Inference Steps', default=5, step=1),
|
23 |
+
gr.inputs.Slider(0, 2147483647, label='Seed', default=random_seed, step=1),
|
24 |
],
|
25 |
+
outputs=gr.Image(shape=[256,256], type="pil", elem_id="output_image"),
|
26 |
+
css="#output_image{width: 256px}",
|
27 |
+
title="ldm-celebahq-256 - 🧨 diffusers library",
|
28 |
+
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>.",
|
29 |
).launch()
|