Ufoptg commited on
Commit
bdd8afc
1 Parent(s): d3d434f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -2
main.py CHANGED
@@ -277,17 +277,21 @@ def dalle_3xl(
277
  response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
278
  response.raise_for_status()
279
  except requests.exceptions.RequestException:
 
 
280
  raise HTTPException(
281
  status_code=500,
282
- detail=CustomErrorResponseModel(error=[{internal_error}])
283
  )
284
 
285
  try:
286
  encoded_string = base64.b64encode(response.content).decode("utf-8")
287
  except Exception:
 
 
288
  raise HTTPException(
289
  status_code=500,
290
- detail=CustomErrorResponseModel(error=[{contact_support}])
291
  )
292
 
293
  if encoded_string:
 
277
  response = requests.post(API_URL, headers=headers, json=payload, timeout=timeout)
278
  response.raise_for_status()
279
  except requests.exceptions.RequestException:
280
+ error_detail = [{"error": internal_error}]
281
+ custom_error_model = CustomErrorResponseModel(detail=error_detail)
282
  raise HTTPException(
283
  status_code=500,
284
+ detail=custom_error_model.dict(),
285
  )
286
 
287
  try:
288
  encoded_string = base64.b64encode(response.content).decode("utf-8")
289
  except Exception:
290
+ error_detail = [{"error": contact_support}]
291
+ custom_error_model = CustomErrorResponseModel(detail=error_detail)
292
  raise HTTPException(
293
  status_code=500,
294
+ detail=custom_error_model.dict(),
295
  )
296
 
297
  if encoded_string: