Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
+
|
4 |
+
pipeline = DiffusionPipeline.from_pretrained("anton-l/ddpm-butterflies-128").to("cuda")
|
5 |
+
|
6 |
+
def diffusion():
|
7 |
+
images = []
|
8 |
+
for i in range(3):
|
9 |
+
image = pipeline(num_inference_steps=25).images[0]
|
10 |
+
images.append(image)
|
11 |
+
return images
|
12 |
+
|
13 |
+
demo = gr.Interface(
|
14 |
+
fn=diffusion,
|
15 |
+
inputs=None,
|
16 |
+
outputs=gr.Gallery(label="generated image", columns=3),
|
17 |
+
title="Unconditional image generation",
|
18 |
+
description="An unconditional diffusion model trained on a dataset of butterfly images."
|
19 |
+
)
|
20 |
+
|
21 |
+
demo.launch(debug=True)
|