zhiweili commited on
Commit
f7998c5
·
1 Parent(s): a001582

fix device

Browse files
Files changed (1) hide show
  1. app_upscale.py +5 -1
app_upscale.py CHANGED
@@ -4,9 +4,13 @@ from io import BytesIO
4
  from diffusers import StableDiffusionUpscalePipeline
5
  import torch
6
 
 
 
 
 
7
  model_id = "stabilityai/stable-diffusion-x4-upscaler"
8
  upscale_pipe = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
9
- upscale_pipe = upscale_pipe.to("cuda")
10
 
11
  DEFAULT_SRC_PROMPT = "a person with pefect face"
12
 
 
4
  from diffusers import StableDiffusionUpscalePipeline
5
  import torch
6
 
7
+ device = "cuda" if torch.cuda.is_available() else "cpu"
8
+
9
+ print('f{device} is available')
10
+
11
  model_id = "stabilityai/stable-diffusion-x4-upscaler"
12
  upscale_pipe = StableDiffusionUpscalePipeline.from_pretrained(model_id, torch_dtype=torch.float16)
13
+ upscale_pipe = upscale_pipe.to(device)
14
 
15
  DEFAULT_SRC_PROMPT = "a person with pefect face"
16