Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,26 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
|
4 |
-
|
|
|
5 |
|
6 |
-
|
|
|
7 |
|
8 |
-
|
|
|
9 |
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from diffusers import StableDiffusionPipeline, AutoencoderKL
|
3 |
|
4 |
+
repo = "IDKiro/sdxs-512-0.9"
|
5 |
+
seed = 42
|
6 |
+
weight_type = torch.float32 # or float16
|
7 |
|
8 |
+
# Load model.
|
9 |
+
pipe = StableDiffusionPipeline.from_pretrained(repo, torch_dtype=weight_type)
|
10 |
|
11 |
+
# use original VAE
|
12 |
+
# pipe.vae = AutoencoderKL.from_pretrained("IDKiro/sdxs-512-0.9/vae_large")
|
13 |
|
14 |
+
pipe.to("cuda")
|
15 |
+
|
16 |
+
prompt = "portrait photo of a girl, photograph, highly detailed face, depth of field, moody light, golden hour"
|
17 |
+
|
18 |
+
# Ensure using 1 inference step and CFG set to 0.
|
19 |
+
image = pipe(
|
20 |
+
prompt,
|
21 |
+
num_inference_steps=1,
|
22 |
+
guidance_scale=0,
|
23 |
+
generator=torch.Generator(device="cuda").manual_seed(seed)
|
24 |
+
).images[0]
|
25 |
+
|
26 |
+
image.save("output.png")
|