ParahumanSkitter commited on
Commit
712546c
·
verified ·
1 Parent(s): 8fe2aca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -47,7 +47,12 @@ def gen_fn(model_str, prompt, negative_prompt, max_retries=10):
47
  result = models_load[model_str](f'{prompt} {noise}')
48
  return result
49
  except Exception as e:
50
- print(f"Error generating image: {e}")
 
 
 
 
 
51
  retries += 1
52
  if retries >= max_retries:
53
  raise Exception(f"Failed to generate image after {max_retries} retries.")
 
47
  result = models_load[model_str](f'{prompt} {noise}')
48
  return result
49
  except Exception as e:
50
+ # Check for specific error messages or status codes
51
+ if "CUDA out of memory" in str(e) or "500" in str(e):
52
+ print(f"CUDA out of memory or server error: {e}")
53
+ else:
54
+ print(f"Error generating image: {e}")
55
+
56
  retries += 1
57
  if retries >= max_retries:
58
  raise Exception(f"Failed to generate image after {max_retries} retries.")