Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from diffusers import DDPMPipeline
|
| 3 |
+
|
| 4 |
+
# Load model
|
| 5 |
+
pipe = DDPMPipeline.from_pretrained("google/ddpm-mnist")
|
| 6 |
+
|
| 7 |
+
def generate():
|
| 8 |
+
image = pipe().images[0]
|
| 9 |
+
return image
|
| 10 |
+
|
| 11 |
+
# Create UI
|
| 12 |
+
gr.Interface(
|
| 13 |
+
fn=generate,
|
| 14 |
+
inputs=[],
|
| 15 |
+
outputs="image",
|
| 16 |
+
title="MNIST Diffusion Generator",
|
| 17 |
+
description="Click button to generate handwritten digit using diffusion model"
|
| 18 |
+
).launch()
|