File size: 485 Bytes
10bd232
 
ac9823f
10bd232
 
162eb52
10bd232
 
 
 
 
 
 
58752cf
10bd232
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from diffusers import DiffusionPipeline
import torch

# Load the pipeline
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-base", torch_dtype=torch.float16)

# If running on CUDA, ensure the model is moved to GPU for faster inference
pipe.to("cuda")

# Get the prompt from the user
prompt = input("What do you want to see? ")

# Generate the image
image = pipe(prompt).images[0]

# Display the image
image.show()

# Print a message
print("How cool is this!")