Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,6 @@ from diffusers import DiffusionPipeline
|
|
| 2 |
import torch
|
| 3 |
import PIL.Image
|
| 4 |
import gradio as gr
|
| 5 |
-
import random
|
| 6 |
import numpy as np
|
| 7 |
|
| 8 |
pipeline = DiffusionPipeline.from_pretrained("1aurent/ddpm-mnist")
|
|
@@ -12,12 +11,11 @@ def predict(steps, seed):
|
|
| 12 |
for i in range(1,steps):
|
| 13 |
yield pipeline(generator=generator, num_inference_steps=i).images[0]
|
| 14 |
|
| 15 |
-
random_seed = random.randint(0, 2147483647)
|
| 16 |
gr.Interface(
|
| 17 |
predict,
|
| 18 |
inputs=[
|
| 19 |
-
gr.inputs.Slider(1, 100, label='Inference Steps', default=
|
| 20 |
-
gr.inputs.Slider(0, 2147483647, label='Seed', default=
|
| 21 |
],
|
| 22 |
outputs=gr.Image(shape=[28,28], type="pil", elem_id="output_image"),
|
| 23 |
css="#output_image{width: 256px}",
|
|
|
|
| 2 |
import torch
|
| 3 |
import PIL.Image
|
| 4 |
import gradio as gr
|
|
|
|
| 5 |
import numpy as np
|
| 6 |
|
| 7 |
pipeline = DiffusionPipeline.from_pretrained("1aurent/ddpm-mnist")
|
|
|
|
| 11 |
for i in range(1,steps):
|
| 12 |
yield pipeline(generator=generator, num_inference_steps=i).images[0]
|
| 13 |
|
|
|
|
| 14 |
gr.Interface(
|
| 15 |
predict,
|
| 16 |
inputs=[
|
| 17 |
+
gr.inputs.Slider(1, 100, label='Inference Steps', default=12, step=1),
|
| 18 |
+
gr.inputs.Slider(0, 2147483647, label='Seed', default=69420, step=1),
|
| 19 |
],
|
| 20 |
outputs=gr.Image(shape=[28,28], type="pil", elem_id="output_image"),
|
| 21 |
css="#output_image{width: 256px}",
|