Spaces:
Sleeping
Sleeping
Add version tracking and model metadata to API
Browse files- Add VERSION = "2.0.0" to track API version
- Add MODEL_VERSION = "CV_Test-2026-01-05" to identify model source
- Add LAST_UPDATED timestamp for deployment tracking
- Include version info in health check endpoints
- Now shows num_classes (11) with 'hi' gesture support
This ensures users can verify the latest model deployment.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
app.py
CHANGED
|
@@ -10,16 +10,22 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
| 10 |
from pydantic import BaseModel
|
| 11 |
from typing import List, Dict
|
| 12 |
import mediapipe as mp
|
|
|
|
| 13 |
|
| 14 |
from model import CustomLSTM
|
| 15 |
from preprocessing import decode_base64_image, process_frame
|
| 16 |
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# Initialize FastAPI app
|
| 19 |
app = FastAPI(
|
| 20 |
title="Sign Language Recognition API",
|
| 21 |
description="Real-time Malaysian Sign Language (MSL) recognition using MediaPipe and LSTM",
|
| 22 |
-
version=
|
| 23 |
)
|
| 24 |
|
| 25 |
# Enable CORS for web app access
|
|
@@ -100,6 +106,10 @@ class HealthResponse(BaseModel):
|
|
| 100 |
device: str
|
| 101 |
model_loaded: bool
|
| 102 |
gestures: List[str]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
|
| 105 |
@app.get("/", response_model=HealthResponse)
|
|
@@ -109,7 +119,11 @@ async def root():
|
|
| 109 |
"status": "healthy",
|
| 110 |
"device": str(device),
|
| 111 |
"model_loaded": True,
|
| 112 |
-
"gestures": GESTURES
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
}
|
| 114 |
|
| 115 |
|
|
@@ -120,7 +134,11 @@ async def health():
|
|
| 120 |
"status": "healthy",
|
| 121 |
"device": str(device),
|
| 122 |
"model_loaded": True,
|
| 123 |
-
"gestures": GESTURES
|
|
|
|
|
|
|
|
|
|
|
|
|
| 124 |
}
|
| 125 |
|
| 126 |
|
|
|
|
| 10 |
from pydantic import BaseModel
|
| 11 |
from typing import List, Dict
|
| 12 |
import mediapipe as mp
|
| 13 |
+
from datetime import datetime
|
| 14 |
|
| 15 |
from model import CustomLSTM
|
| 16 |
from preprocessing import decode_base64_image, process_frame
|
| 17 |
|
| 18 |
|
| 19 |
+
# Version and deployment info
|
| 20 |
+
VERSION = "2.0.0"
|
| 21 |
+
MODEL_VERSION = "CV_Test-2026-01-05" # Updated with 'hi' gesture support
|
| 22 |
+
LAST_UPDATED = "2026-01-05T10:00:00Z"
|
| 23 |
+
|
| 24 |
# Initialize FastAPI app
|
| 25 |
app = FastAPI(
|
| 26 |
title="Sign Language Recognition API",
|
| 27 |
description="Real-time Malaysian Sign Language (MSL) recognition using MediaPipe and LSTM",
|
| 28 |
+
version=VERSION
|
| 29 |
)
|
| 30 |
|
| 31 |
# Enable CORS for web app access
|
|
|
|
| 106 |
device: str
|
| 107 |
model_loaded: bool
|
| 108 |
gestures: List[str]
|
| 109 |
+
version: str
|
| 110 |
+
model_version: str
|
| 111 |
+
last_updated: str
|
| 112 |
+
num_classes: int
|
| 113 |
|
| 114 |
|
| 115 |
@app.get("/", response_model=HealthResponse)
|
|
|
|
| 119 |
"status": "healthy",
|
| 120 |
"device": str(device),
|
| 121 |
"model_loaded": True,
|
| 122 |
+
"gestures": GESTURES,
|
| 123 |
+
"version": VERSION,
|
| 124 |
+
"model_version": MODEL_VERSION,
|
| 125 |
+
"last_updated": LAST_UPDATED,
|
| 126 |
+
"num_classes": NUM_CLASSES
|
| 127 |
}
|
| 128 |
|
| 129 |
|
|
|
|
| 134 |
"status": "healthy",
|
| 135 |
"device": str(device),
|
| 136 |
"model_loaded": True,
|
| 137 |
+
"gestures": GESTURES,
|
| 138 |
+
"version": VERSION,
|
| 139 |
+
"model_version": MODEL_VERSION,
|
| 140 |
+
"last_updated": LAST_UPDATED,
|
| 141 |
+
"num_classes": NUM_CLASSES
|
| 142 |
}
|
| 143 |
|
| 144 |
|