Update app.py
Browse files
app.py
CHANGED
|
@@ -11,20 +11,20 @@ from typing import Any
|
|
| 11 |
|
| 12 |
app = FastAPI()
|
| 13 |
|
| 14 |
-
@app.exception_handler(ValidationError)
|
| 15 |
-
async def validation_exception_handler(request: Request, exc: ValidationError):
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
|
| 29 |
# Încărcăm modelul
|
| 30 |
try:
|
|
@@ -203,7 +203,4 @@ async def model_info():
|
|
| 203 |
"min_samples_split": 6,
|
| 204 |
"min_samples_leaf": 2
|
| 205 |
}
|
| 206 |
-
}
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
|
|
|
| 11 |
|
| 12 |
app = FastAPI()
|
| 13 |
|
| 14 |
+
# @app.exception_handler(ValidationError)
|
| 15 |
+
# async def validation_exception_handler(request: Request, exc: ValidationError):
|
| 16 |
+
# errors = []
|
| 17 |
+
# for error in exc.errors():
|
| 18 |
+
# # Elimină prefixul "Value error" din mesaj
|
| 19 |
+
# message = error['msg']
|
| 20 |
+
# if message.startswith("Value error, "):
|
| 21 |
+
# message = message[12:] # Lungimea "Value error: " este 12
|
| 22 |
+
# errors.append({"loc": error['loc'], "msg": message})
|
| 23 |
|
| 24 |
+
# return JSONResponse(
|
| 25 |
+
# status_code=422,
|
| 26 |
+
# content={"detail": errors}
|
| 27 |
+
# )
|
| 28 |
|
| 29 |
# Încărcăm modelul
|
| 30 |
try:
|
|
|
|
| 203 |
"min_samples_split": 6,
|
| 204 |
"min_samples_leaf": 2
|
| 205 |
}
|
| 206 |
+
}
|
|
|
|
|
|
|
|
|