AisingioroHao0 commited on
Commit
2c2a920
·
1 Parent(s): b870664

add support cuda

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -9,8 +9,13 @@ from PIL import Image
9
  import cv2
10
  import numpy as np
11
  import os
 
 
 
 
 
 
12
 
13
- device = "cpu"
14
  automatic_coloring_pipeline = StableDiffusionReferenceOnlyPipeline.from_pretrained(
15
  "AisingioroHao0/stable-diffusion-reference-only-automatic-coloring-0.1.2"
16
  ).to(device)
 
9
  import cv2
10
  import numpy as np
11
  import os
12
+ import torch
13
+
14
+ if torch.cuda.is_available():
15
+ device = "cuda"
16
+ else:
17
+ device = "cpu"
18
 
 
19
  automatic_coloring_pipeline = StableDiffusionReferenceOnlyPipeline.from_pretrained(
20
  "AisingioroHao0/stable-diffusion-reference-only-automatic-coloring-0.1.2"
21
  ).to(device)