P01yH3dr0n commited on
Commit
e0d733d
1 Parent(s): 18639dd

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +6 -1
utils.py CHANGED
@@ -99,7 +99,12 @@ def generate_novelai_image(
99
  payload['parameters']['strength'] = i2i_str
100
  payload['parameters']['extra_noise_seed'] = seed
101
  # Send the POST request
102
- response = requests.post(url, json=payload, headers=headers, timeout=30)
 
 
 
 
 
103
 
104
  # Process the response
105
  if response.headers.get('Content-Type') == 'application/x-zip-compressed':
 
99
  payload['parameters']['strength'] = i2i_str
100
  payload['parameters']['extra_noise_seed'] = seed
101
  # Send the POST request
102
+ try {
103
+ response = requests.post(url, json=payload, headers=headers, timeout=20)
104
+ }
105
+ except {
106
+ return None, {'message': 'NAI response timeout'}
107
+ }
108
 
109
  # Process the response
110
  if response.headers.get('Content-Type') == 'application/x-zip-compressed':