Malik99999 commited on
Commit
25cedca
·
verified ·
1 Parent(s): cd36950

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +5 -12
run.py CHANGED
@@ -1,20 +1,13 @@
1
  from diffusers import StableDiffusionPipeline
2
  import torch
3
 
4
- # Load the model (make sure the model is loaded from the correct path)
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
- # Example prompt
14
- prompt = "A beautiful landscape at sunrise"
15
-
16
- # Generate the image
17
  image = pipeline(prompt).images[0]
18
 
19
- # Save or display the image
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")