New File
Browse files
app.py
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from torch import autocast
|
3 |
+
from diffusers import StableDiffusionPipeline
|
4 |
+
|
5 |
+
model_id = "hakurei/waifu-diffusion"
|
6 |
+
device = "cuda"
|
7 |
+
|
8 |
+
|
9 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16, revision='fp16')
|
10 |
+
pipe = pipe.to(device)
|
11 |
+
|
12 |
+
prompt = "touhou hakurei_reimu 1girl solo portrait"
|
13 |
+
with autocast("cuda"):
|
14 |
+
image = pipe(prompt, guidance_scale=7.5)["sample"][0]
|
15 |
+
|
16 |
+
image.save("reimu_hakurei.png")
|