Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,32 +1,22 @@
|
|
1 |
-
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline,
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
from PIL import Image
|
5 |
|
6 |
model_id = 'Norod78/sd2-simpsons-blip'
|
7 |
prefix = None
|
8 |
-
|
9 |
-
scheduler = DPMSolverMultistepScheduler(
|
10 |
-
beta_start=0.00085,
|
11 |
-
beta_end=0.012,
|
12 |
-
beta_schedule="scaled_linear",
|
13 |
-
num_train_timesteps=1000,
|
14 |
-
trained_betas=None,
|
15 |
-
thresholding=False,
|
16 |
-
algorithm_type="dpmsolver++",
|
17 |
-
solver_type="midpoint",
|
18 |
-
lower_order_final=True,
|
19 |
-
)
|
20 |
|
21 |
pipe = StableDiffusionPipeline.from_pretrained(
|
22 |
model_id,
|
23 |
-
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32
|
24 |
-
|
|
|
25 |
|
26 |
pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(
|
27 |
model_id,
|
28 |
-
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32
|
29 |
-
|
|
|
30 |
|
31 |
if torch.cuda.is_available():
|
32 |
pipe = pipe.to("cuda")
|
|
|
1 |
+
from diffusers import StableDiffusionPipeline, StableDiffusionImg2ImgPipeline, UniPCMultistepScheduler
|
2 |
import gradio as gr
|
3 |
import torch
|
4 |
from PIL import Image
|
5 |
|
6 |
model_id = 'Norod78/sd2-simpsons-blip'
|
7 |
prefix = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
pipe = StableDiffusionPipeline.from_pretrained(
|
10 |
model_id,
|
11 |
+
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32)
|
12 |
+
|
13 |
+
pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
|
14 |
|
15 |
pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(
|
16 |
model_id,
|
17 |
+
torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32)
|
18 |
+
|
19 |
+
pipe_i2i.scheduler = UniPCMultistepScheduler.from_config(pipe_i2i.scheduler.config)
|
20 |
|
21 |
if torch.cuda.is_available():
|
22 |
pipe = pipe.to("cuda")
|