docker_python / app.py
nyrt's picture
Update app.py
8edcaf6
raw
history blame contribute delete
426 Bytes
print("Start")
import torch
from diffusers import StableDiffusionPipeline
model_id = "CompVis/stable-diffusion-v1-4"
device = "cuda"
print("Init Pipeline")
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
print("Add device to pipeline")
pipe = pipe.to(device)
prompt = "a photo of an astronaut riding a horse on mars"
print("Generating image")
image = pipe(prompt).images[0]
print("Done")