Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,19 +46,19 @@ from backend.ingest.ingest_invoice_sqlite import ingest_invoice as ingest_func
|
|
| 46 |
from backend.app.api.ingest import router as ingest_router
|
| 47 |
|
| 48 |
# Load ML model
|
| 49 |
-
print("
|
| 50 |
try:
|
| 51 |
model_artifacts = joblib.load(MODEL_PATH)
|
| 52 |
model = model_artifacts['model']
|
| 53 |
-
print(f"
|
| 54 |
except Exception as e:
|
| 55 |
-
print(f"
|
| 56 |
model = None
|
| 57 |
|
| 58 |
# FastAPI app
|
| 59 |
app = FastAPI(
|
| 60 |
-
title="Invoice
|
| 61 |
-
description="
|
| 62 |
version="1.0.0"
|
| 63 |
)
|
| 64 |
|
|
@@ -231,7 +231,7 @@ def log_prediction_to_db(prediction_data: Dict):
|
|
| 231 |
def root():
|
| 232 |
"""Root endpoint."""
|
| 233 |
return {
|
| 234 |
-
"service": "Invoice
|
| 235 |
"version": "1.0.0",
|
| 236 |
"status": "operational",
|
| 237 |
"model_loaded": model is not None
|
|
|
|
| 46 |
from backend.app.api.ingest import router as ingest_router
|
| 47 |
|
| 48 |
# Load ML model
|
| 49 |
+
print(" Loading ML model...")
|
| 50 |
try:
|
| 51 |
model_artifacts = joblib.load(MODEL_PATH)
|
| 52 |
model = model_artifacts['model']
|
| 53 |
+
print(f" Model loaded: {MODEL_PATH.name}")
|
| 54 |
except Exception as e:
|
| 55 |
+
print(f" Failed to load model: {e}")
|
| 56 |
model = None
|
| 57 |
|
| 58 |
# FastAPI app
|
| 59 |
app = FastAPI(
|
| 60 |
+
title="Invoice Digitization",
|
| 61 |
+
description="Degitize invoice",
|
| 62 |
version="1.0.0"
|
| 63 |
)
|
| 64 |
|
|
|
|
| 231 |
def root():
|
| 232 |
"""Root endpoint."""
|
| 233 |
return {
|
| 234 |
+
"service": "Invoice Digitization",
|
| 235 |
"version": "1.0.0",
|
| 236 |
"status": "operational",
|
| 237 |
"model_loaded": model is not None
|