skkk commited on
Commit
3081e1d
1 Parent(s): d2ad507
Files changed (1) hide show
  1. Rodin.py +8 -2
Rodin.py CHANGED
@@ -167,8 +167,14 @@ class Generator:
167
  raise gr.Error("Error in image preprocessing, please try again.")
168
 
169
  if 'error' in preprocess_response:
170
- log("ERROR", f"Error in image preprocessing: {preprocess_response['error']}")
171
- raise RuntimeError
 
 
 
 
 
 
172
  elif preprocess_response.get("statusCode") == 401:
173
  log("WARNING", "Token expired. Logging in again...")
174
  _, self.token = login(self.user_id, self.password)
 
167
  raise gr.Error("Error in image preprocessing, please try again.")
168
 
169
  if 'error' in preprocess_response:
170
+ log("ERROR", f"Error in image preprocessing: {preprocess_response}")
171
+ raise gr.Error("Error in image preprocessing, please try again.")
172
+ elif preprocess_response.get("statusCode") == 400:
173
+ if "InvalidFile.Content" in preprocess_response.get("message"):
174
+ raise gr.Error("Invalid Image Format")
175
+ else:
176
+ log("ERROR", f"Error in image preprocessing: {preprocess_response}")
177
+ raise gr.Error("Busy connection, please try again later.")
178
  elif preprocess_response.get("statusCode") == 401:
179
  log("WARNING", "Token expired. Logging in again...")
180
  _, self.token = login(self.user_id, self.password)