Spaces:
Sleeping
Sleeping
nroggendorff
commited on
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
+
|
4 |
+
def generate_image(steps):
|
5 |
+
pipeline = DiffusionPipeline.from_pretrained("nroggendorff/anime", use_safetensors=True)
|
6 |
+
pipe = pipeline#.to("cuda")
|
7 |
+
image = pipe(num_inference_steps=steps).images[0]
|
8 |
+
return image
|
9 |
+
|
10 |
+
with gr.Blocks() as demo:
|
11 |
+
sampling_steps = gr.Slider(value=1000, minimum=20, maximum=1000, label="Sampling Steps", info="How many iterations per image")
|
12 |
+
btn = gr.Button("Generate Image")
|
13 |
+
output_image = gr.Image(label="Generated Image")
|
14 |
+
|
15 |
+
btn.click(fn=generate_image, inputs=sampling_steps, outputs=output_image)
|
16 |
+
|
17 |
+
demo.launch()
|