brendon-ai commited on
Commit
cc2745c
·
verified ·
1 Parent(s): de7dbb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -85,20 +85,20 @@ async def predict_masked_lm(request: InferenceRequest):
85
  logger.info(f"Successfully processed request. Returning {len(results)} predictions.")
86
  return results
87
 
88
- except ValidationError as e:
89
- logger.error(f"Validation error for request: {e.errors()}")
90
- raise HTTPException(
91
- status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
92
- detail=e.errors()
93
- )
94
- except HTTPException:
95
- raise
96
- except Exception as e:
97
- logger.exception(f"An unexpected error occurred during prediction: {e}")
98
- raise HTTPException(
99
- status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
100
- detail=f"An internal server error occurred: {e}"
101
- )
102
 
103
  @api_router.get(
104
  "/health", # Health check endpoint
 
85
  logger.info(f"Successfully processed request. Returning {len(results)} predictions.")
86
  return results
87
 
88
+ except ValidationError as e: # This is line 88
89
+ logger.error(f"Validation error for request: {e.errors()}")
90
+ raise HTTPException(
91
+ status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
92
+ detail=e.errors()
93
+ )
94
+ except HTTPException:
95
+ raise
96
+ except Exception as e:
97
+ logger.exception(f"An unexpected error occurred during prediction: {e}")
98
+ raise HTTPException(
99
+ status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
100
+ detail=f"An internal server error occurred: {e}"
101
+ )
102
 
103
  @api_router.get(
104
  "/health", # Health check endpoint