Spaces:
Runtime error
Runtime error
Oleg Lavrovsky
commited on
Catch all exceptions
Browse files
app.py
CHANGED
|
@@ -173,8 +173,8 @@ async def completion(data: Completion):
|
|
| 173 |
"total_tokens": len(text) + len(result)
|
| 174 |
}
|
| 175 |
}
|
| 176 |
-
except
|
| 177 |
-
raise HTTPException(status_code=400, detail="
|
| 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
|
| 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 |
|