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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -5,12 +5,15 @@ api_key = "your_huggingface_api_key"
5
 
6
  # Load the Stable Diffusion pipeline with the API key
7
  pipeline = StableDiffusionPipeline.from_pretrained(
8
- "stabilityai/stable-diffusion-v1-5-base",
9
  use_auth_token=api_key
10
  )
11
 
 
 
 
12
  # Generate an image
13
- prompt = "A beautiful futuristic cityscape at night"
14
  image = pipeline(prompt).images[0]
15
 
16
  # Save the generated image
 
5
 
6
  # Load the Stable Diffusion pipeline with the API key
7
  pipeline = StableDiffusionPipeline.from_pretrained(
8
+ "CompVis/stable-diffusion-v1-4",
9
  use_auth_token=api_key
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"
17
  image = pipeline(prompt).images[0]
18
 
19
  # Save the generated image