rezaarmand commited on
Commit
7da3063
1 Parent(s): afd9e6c

change the cpu

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -89,12 +89,11 @@ def predict(prompt, weights, seed, scale=7.5, steps=50):
89
  try:
90
  with torch.no_grad():
91
  has_cuda = torch.cuda.is_available()
92
- with autocast('cpu' if not has_cuda else 'cuda'):
93
- if has_cuda:
94
- generator = torch.Generator('cuda').manual_seed(int(seed))
95
- else:
96
- generator = torch.Generator().manual_seed(int(seed))
97
- image_perpneg = pipe(prompt, guidance_scale=float(scale), generator=generator,
98
  num_inference_steps=steps, weights=weights)["images"][0]
99
  return image_perpneg
100
  except Exception as e:
 
89
  try:
90
  with torch.no_grad():
91
  has_cuda = torch.cuda.is_available()
92
+ if has_cuda:
93
+ generator = torch.Generator('cuda').manual_seed(int(seed))
94
+ else:
95
+ generator = torch.Generator().manual_seed(int(seed))
96
+ image_perpneg = pipe(prompt, guidance_scale=float(scale), generator=generator,
 
97
  num_inference_steps=steps, weights=weights)["images"][0]
98
  return image_perpneg
99
  except Exception as e: