Spaces:
Runtime error
Runtime error
Commit
·
fc4eaf7
1
Parent(s):
3d0d468
Initial attempt
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from diffusers import StableDiffusionPipeline
|
4 |
+
|
5 |
+
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4", torch_dtype=torch.float16)
|
6 |
+
|
7 |
+
def diffusion(prompt, filename):
|
8 |
+
image = pipe(prompt).images[0]
|
9 |
+
image.save(filename)
|
10 |
+
return image
|
11 |
+
|
12 |
+
iface = gr.Interface(fn=diffusion, inputs="text", outputs="image")
|
13 |
+
iface.launch()
|