Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,16 @@
|
|
|
|
1 |
import spaces
|
2 |
import gradio as gr
|
3 |
from diffusers import StableDiffusionPipeline
|
|
|
4 |
|
5 |
-
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4")
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
pipe.to('cuda')
|
8 |
|
9 |
@spaces.GPU
|
10 |
def generate(prompt):
|
|
|
1 |
+
import torch
|
2 |
import spaces
|
3 |
import gradio as gr
|
4 |
from diffusers import StableDiffusionPipeline
|
5 |
+
from open_clip import create_model_and_transforms
|
6 |
|
7 |
+
pipe = StableDiffusionPipeline.from_pretrained("CompVis/stable-diffusion-v1-4").to('cuda')
|
8 |
+
model, _, _ = create_model_and_transforms(
|
9 |
+
"ViT-H-14",
|
10 |
+
device=torch.device("cpu"),
|
11 |
+
pretrained="laion2b_s32b_b79k",
|
12 |
+
)
|
13 |
|
|
|
14 |
|
15 |
@spaces.GPU
|
16 |
def generate(prompt):
|