Doron Adler commited on
Commit
5ab52c6
1 Parent(s): f65864c

Fixed a crash when running on CPU and a custom seed was set

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -39,7 +39,10 @@ def error_str(error, title="Error"):
39
 
40
  def inference(prompt, guidance, steps, width=512, height=512, seed=0, img=None, strength=0.5, neg_prompt=""):
41
 
42
- generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
 
 
 
43
 
44
  try:
45
  if img is not None:
 
39
 
40
  def inference(prompt, guidance, steps, width=512, height=512, seed=0, img=None, strength=0.5, neg_prompt=""):
41
 
42
+ if torch.cuda.is_available():
43
+ generator = torch.Generator('cuda').manual_seed(seed) if seed != 0 else None
44
+ else:
45
+ generator = torch.Generator.manual_seed(seed) if seed != 0 else None
46
 
47
  try:
48
  if img is not None: