vumichien commited on
Commit
41716f6
·
1 Parent(s): 20d2ab6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -54,8 +54,10 @@ def process(input_image, prompt, a_prompt, n_prompt, num_samples, image_resoluti
54
  detected_map = cv2.GaussianBlur(detected_map, (0, 0), 3.0)
55
  detected_map[detected_map > 4] = 255
56
  detected_map[detected_map < 255] = 0
57
-
58
- control = torch.from_numpy(detected_map.copy()).float().cuda() / 255.0
 
 
59
  control = torch.stack([control for _ in range(num_samples)], dim=0)
60
  control = einops.rearrange(control, 'b h w c -> b c h w').clone()
61
 
 
54
  detected_map = cv2.GaussianBlur(detected_map, (0, 0), 3.0)
55
  detected_map[detected_map > 4] = 255
56
  detected_map[detected_map < 255] = 0
57
+ if torch.cuda.is_available():
58
+ control = torch.from_numpy(detected_map.copy()).float().cuda() / 255.0
59
+ else:
60
+ control = torch.from_numpy(detected_map.copy()).float() / 255.0
61
  control = torch.stack([control for _ in range(num_samples)], dim=0)
62
  control = einops.rearrange(control, 'b h w c -> b c h w').clone()
63