akazmi commited on
Commit
95ba608
·
verified ·
1 Parent(s): 3591c2a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  from diffusers import StableDiffusionPipeline
2
 
3
  # Hugging Face API key
@@ -10,7 +11,8 @@ pipeline = StableDiffusionPipeline.from_pretrained(
10
  )
11
 
12
  # Move the pipeline to GPU if available
13
- pipeline.to("cuda" if torch.cuda.is_available() else "cpu")
 
14
 
15
  # Generate an image
16
  prompt = "A serene lake surrounded by mountains during sunset"
 
1
+ import torch
2
  from diffusers import StableDiffusionPipeline
3
 
4
  # Hugging Face API key
 
11
  )
12
 
13
  # Move the pipeline to GPU if available
14
+ device = "cuda" if torch.cuda.is_available() else "cpu"
15
+ pipeline.to(device)
16
 
17
  # Generate an image
18
  prompt = "A serene lake surrounded by mountains during sunset"