File size: 653 Bytes
e9994f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
pip install --upgrade git+https://github.com/huggingface/diffusers.git transformers accelerate scipy

import torch
from diffusers import StableDiffusionPipeline, EulerDiscreteScheduler
torch.manual_seed(1000)
model_id = "stabilityai/stable-diffusion-2"

# Use the Euler scheduler here instead
scheduler = EulerDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler")
pipe = StableDiffusionPipeline.from_pretrained(model_id, scheduler=scheduler, revision="fp16", torch_dtype=torch.float16)
pipe = pipe.to("cuda")


prompt = input()
image = pipe(prompt).images[0]
image.save("./image.png")
from IPython.display import Image
Image("./image.png")