radames HF staff commited on
Commit
fb49ce5
1 Parent(s): dcacd5b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -5,10 +5,11 @@ import numpy as np
5
  from diffusers import StableDiffusionDepth2ImgPipeline
6
  from pathlib import Path
7
 
 
8
  dept2img = StableDiffusionDepth2ImgPipeline.from_pretrained(
9
  "stabilityai/stable-diffusion-2-depth",
10
  torch_dtype=torch.float16,
11
- ).to("cuda")
12
 
13
 
14
  def pad_image(input_image):
 
5
  from diffusers import StableDiffusionDepth2ImgPipeline
6
  from pathlib import Path
7
 
8
+ device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
9
  dept2img = StableDiffusionDepth2ImgPipeline.from_pretrained(
10
  "stabilityai/stable-diffusion-2-depth",
11
  torch_dtype=torch.float16,
12
+ ).to(device)
13
 
14
 
15
  def pad_image(input_image):