Update run.py
Browse files
run.py
CHANGED
@@ -1,20 +1,13 @@
|
|
1 |
from diffusers import StableDiffusionPipeline
|
2 |
import torch
|
3 |
|
4 |
-
# Load the model
|
5 |
-
pipeline = StableDiffusionPipeline.from_pretrained(
|
6 |
-
"Malik99999/MyModel",
|
7 |
-
torch_dtype=torch.float16
|
8 |
-
)
|
9 |
-
|
10 |
-
# Move model to GPU (if available)
|
11 |
pipeline.to("cuda" if torch.cuda.is_available() else "cpu")
|
12 |
|
13 |
-
#
|
14 |
-
prompt = "A beautiful landscape at
|
15 |
-
|
16 |
-
# Generate the image
|
17 |
image = pipeline(prompt).images[0]
|
18 |
|
19 |
-
# Save
|
20 |
image.save("generated_image.png")
|
|
|
1 |
from diffusers import StableDiffusionPipeline
|
2 |
import torch
|
3 |
|
4 |
+
# Load the model from Hugging Face repo
|
5 |
+
pipeline = StableDiffusionPipeline.from_pretrained("Malik99999/MyModel")
|
|
|
|
|
|
|
|
|
|
|
6 |
pipeline.to("cuda" if torch.cuda.is_available() else "cpu")
|
7 |
|
8 |
+
# Generate an image from a prompt
|
9 |
+
prompt = "A beautiful landscape at sunset"
|
|
|
|
|
10 |
image = pipeline(prompt).images[0]
|
11 |
|
12 |
+
# Save the generated image
|
13 |
image.save("generated_image.png")
|