Oleg Lavrovsky commited on
Commit
9857cc7
·
unverified ·
1 Parent(s): 57411e2

Catch all exceptions

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -173,8 +173,8 @@ async def completion(data: Completion):
173
  "total_tokens": len(text) + len(result)
174
  }
175
  }
176
- except ValidationError as e:
177
- raise HTTPException(status_code=400, detail="Invalid input data") from e
178
 
179
 
180
  @app.get("/predict", response_model=ModelResponse)
@@ -205,7 +205,7 @@ async def predict(q: str):
205
  processing_time=processing_time
206
  )
207
 
208
- except HTTPException as e:
209
  logger.error(f"Evaluation error: {e}")
210
  raise HTTPException(status_code=500, detail="Evaluation failed")
211
 
 
173
  "total_tokens": len(text) + len(result)
174
  }
175
  }
176
+ except Exception as e:
177
+ raise HTTPException(status_code=400, detail="Could not process") from e
178
 
179
 
180
  @app.get("/predict", response_model=ModelResponse)
 
205
  processing_time=processing_time
206
  )
207
 
208
+ except Exception as e:
209
  logger.error(f"Evaluation error: {e}")
210
  raise HTTPException(status_code=500, detail="Evaluation failed")
211