Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,20 @@
|
|
1 |
-
import
|
2 |
-
|
3 |
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
pipe
|
8 |
-
|
|
|
|
|
|
|
|
|
9 |
image = pipe(prompt).images[0]
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
from diffusers import DiffusionPipeline
|
2 |
+
import torch
|
3 |
|
4 |
+
# Load the pipeline
|
5 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-base", torch_dtype=torch.float16)
|
6 |
|
7 |
+
# If running on CUDA, ensure the model is moved to GPU for faster inference
|
8 |
+
pipe.to("cuda")
|
9 |
+
|
10 |
+
# Get the prompt from the user
|
11 |
+
prompt = input("What do you want to see? ")
|
12 |
+
|
13 |
+
# Generate the image
|
14 |
image = pipe(prompt).images[0]
|
15 |
+
|
16 |
+
# Display the image
|
17 |
+
image.show()
|
18 |
+
|
19 |
+
# Print a message
|
20 |
+
print("How cool is this!")
|