Spaces:
Runtime error
Runtime error
dave-blend
commited on
Commit
·
60f02f2
1
Parent(s):
3addb5e
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
gr.Interface.load("models/Deci/DeciDiffusion-v1-0").launch()
|
|
|
1 |
+
# pip install diffusers transformers torch
|
2 |
+
|
3 |
+
from diffusers import StableDiffusionPipeline
|
4 |
+
import torch
|
5 |
+
|
6 |
+
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
7 |
+
|
8 |
+
checkpoint = "Deci/DeciDiffusion-v1-0"
|
9 |
+
pipeline = StableDiffusionPipeline.from_pretrained(checkpoint, custom_pipeline=checkpoint, torch_dtype=torch.float16)
|
10 |
+
pipeline.unet = pipeline.unet.from_pretrained(checkpoint, subfolder='flexible_unet', torch_dtype=torch.float16)
|
11 |
+
|
12 |
+
pipeline = pipeline.to(device)
|
13 |
+
|
14 |
+
img = pipeline(prompt=['A photo of an astronaut riding a horse on Mars']).images[0]
|
15 |
+
|
16 |
import gradio as gr
|
17 |
|
18 |
gr.Interface.load("models/Deci/DeciDiffusion-v1-0").launch()
|