Spaces:
Paused
Paused
Prathamesh Sarjerao Vaidya
commited on
Commit
Β·
f23f7e6
1
Parent(s):
12f8480
made changes
Browse files- Dockerfile +2 -2
- backend/app/old_config.py +0 -71
- docs/DOCUMENTATION.md +10 -10
- startup.sh +1 -1
Dockerfile
CHANGED
|
@@ -79,12 +79,12 @@ RUN chmod -R 755 /usr/local/lib/python3.10/site-packages/mediapipe && \
|
|
| 79 |
USER appuser
|
| 80 |
|
| 81 |
# Expose ports
|
| 82 |
-
EXPOSE 8000
|
| 83 |
EXPOSE 7860
|
|
|
|
| 84 |
|
| 85 |
# Health check
|
| 86 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5m --retries=3 \
|
| 87 |
-
CMD python -c "import requests; requests.get('http://localhost:
|
| 88 |
|
| 89 |
# Start application
|
| 90 |
CMD ["/app/startup.sh"]
|
|
|
|
| 79 |
USER appuser
|
| 80 |
|
| 81 |
# Expose ports
|
|
|
|
| 82 |
EXPOSE 7860
|
| 83 |
+
EXPOSE 8000
|
| 84 |
|
| 85 |
# Health check
|
| 86 |
HEALTHCHECK --interval=30s --timeout=10s --start-period=5m --retries=3 \
|
| 87 |
+
CMD python -c "import requests; requests.get('http://localhost:7860/health')" || exit 1
|
| 88 |
|
| 89 |
# Start application
|
| 90 |
CMD ["/app/startup.sh"]
|
backend/app/old_config.py
DELETED
|
@@ -1,71 +0,0 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Configuration management for Dance Movement Analyzer
|
| 3 |
-
Centralizes all application settings and constants
|
| 4 |
-
"""
|
| 5 |
-
|
| 6 |
-
import os
|
| 7 |
-
from pathlib import Path
|
| 8 |
-
from typing import List
|
| 9 |
-
|
| 10 |
-
class Config:
|
| 11 |
-
"""Application configuration with environment variable support"""
|
| 12 |
-
|
| 13 |
-
# Application Settings
|
| 14 |
-
APP_NAME: str = "Dance Movement Analyzer"
|
| 15 |
-
VERSION: str = "1.0.0"
|
| 16 |
-
DEBUG: bool = os.getenv("DEBUG", "False").lower() == "true"
|
| 17 |
-
|
| 18 |
-
# File Upload Settings
|
| 19 |
-
MAX_FILE_SIZE: int = 100 * 1024 * 1024 # 100MB
|
| 20 |
-
ALLOWED_EXTENSIONS: List[str] = [".mp4", ".avi", ".mov", ".mkv", ".webm"]
|
| 21 |
-
UPLOAD_FOLDER: Path = Path("uploads")
|
| 22 |
-
OUTPUT_FOLDER: Path = Path("outputs")
|
| 23 |
-
|
| 24 |
-
# Video Processing Settings
|
| 25 |
-
MAX_VIDEO_DURATION: int = 60 # seconds
|
| 26 |
-
TARGET_FPS: int = 30
|
| 27 |
-
FRAME_SKIP: int = 1 # Process every Nth frame (1 = no skip)
|
| 28 |
-
|
| 29 |
-
# MediaPipe Configuration
|
| 30 |
-
MEDIAPIPE_MODEL_COMPLEXITY: int = 1 # 0=Lite, 1=Full, 2=Heavy
|
| 31 |
-
MEDIAPIPE_MIN_DETECTION_CONFIDENCE: float = 0.5
|
| 32 |
-
MEDIAPIPE_MIN_TRACKING_CONFIDENCE: float = 0.5
|
| 33 |
-
MEDIAPIPE_SMOOTH_LANDMARKS: bool = True
|
| 34 |
-
|
| 35 |
-
# Skeleton Overlay Settings
|
| 36 |
-
SKELETON_LINE_THICKNESS: int = 2
|
| 37 |
-
SKELETON_CIRCLE_RADIUS: int = 4
|
| 38 |
-
SKELETON_COLOR: tuple = (0, 255, 0) # Green in BGR
|
| 39 |
-
SKELETON_CONFIDENCE_THRESHOLD: float = 0.5
|
| 40 |
-
|
| 41 |
-
# Movement Classification Thresholds
|
| 42 |
-
MOVEMENT_INTENSITY_LOW: float = 0.02
|
| 43 |
-
MOVEMENT_INTENSITY_MEDIUM: float = 0.05
|
| 44 |
-
MOVEMENT_INTENSITY_HIGH: float = 0.10
|
| 45 |
-
|
| 46 |
-
# Movement velocity thresholds (normalized units)
|
| 47 |
-
VELOCITY_STANDING: float = 0.01
|
| 48 |
-
VELOCITY_WALKING: float = 0.03
|
| 49 |
-
VELOCITY_DANCING: float = 0.06
|
| 50 |
-
VELOCITY_JUMPING: float = 0.12
|
| 51 |
-
|
| 52 |
-
# API Settings
|
| 53 |
-
API_HOST: str = os.getenv("API_HOST", "0.0.0.0")
|
| 54 |
-
API_PORT: int = int(os.getenv("API_PORT", "8000"))
|
| 55 |
-
CORS_ORIGINS: List[str] = ["*"]
|
| 56 |
-
|
| 57 |
-
@classmethod
|
| 58 |
-
def initialize_folders(cls):
|
| 59 |
-
"""Create necessary folders if they don't exist"""
|
| 60 |
-
cls.UPLOAD_FOLDER.mkdir(exist_ok=True)
|
| 61 |
-
cls.OUTPUT_FOLDER.mkdir(exist_ok=True)
|
| 62 |
-
|
| 63 |
-
@classmethod
|
| 64 |
-
def get_mediapipe_config(cls) -> dict:
|
| 65 |
-
"""Get MediaPipe Pose configuration as dictionary"""
|
| 66 |
-
return {
|
| 67 |
-
"model_complexity": cls.MEDIAPIPE_MODEL_COMPLEXITY,
|
| 68 |
-
"min_detection_confidence": cls.MEDIAPIPE_MIN_DETECTION_CONFIDENCE,
|
| 69 |
-
"min_tracking_confidence": cls.MEDIAPIPE_MIN_TRACKING_CONFIDENCE,
|
| 70 |
-
"smooth_landmarks": cls.MEDIAPIPE_SMOOTH_LANDMARKS
|
| 71 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
docs/DOCUMENTATION.md
CHANGED
|
@@ -188,7 +188,7 @@ cp .env.example .env
|
|
| 188 |
|
| 189 |
# Edit .env with your preferences
|
| 190 |
# API_HOST=0.0.0.0
|
| 191 |
-
# API_PORT=
|
| 192 |
# DEBUG=false
|
| 193 |
# MAX_FILE_SIZE=104857600
|
| 194 |
```
|
|
@@ -199,13 +199,13 @@ cp .env.example .env
|
|
| 199 |
python app/main.py
|
| 200 |
|
| 201 |
# Or use uvicorn directly
|
| 202 |
-
uvicorn app.main:app --host 0.0.0.0 --port
|
| 203 |
```
|
| 204 |
|
| 205 |
#### **Step 5: Access Application**
|
| 206 |
-
- **Web Interface**: http://localhost:
|
| 207 |
-
- **API Documentation**: http://localhost:
|
| 208 |
-
- **Health Check**: http://localhost:
|
| 209 |
|
| 210 |
### **b. Docker Deployment**
|
| 211 |
|
|
@@ -225,8 +225,8 @@ docker-compose logs -f
|
|
| 225 |
```
|
| 226 |
|
| 227 |
#### **Step 3: Access Application**
|
| 228 |
-
- **Web Interface**: http://localhost:
|
| 229 |
-
- **API Documentation**: http://localhost:
|
| 230 |
|
| 231 |
#### **Step 4: Manage Services**
|
| 232 |
```bash
|
|
@@ -752,7 +752,7 @@ class Visualizer {
|
|
| 752 |
|
| 753 |
**Upload Video:**
|
| 754 |
```bash
|
| 755 |
-
curl -X POST http://localhost:
|
| 756 |
-F "file=@dance.mp4"
|
| 757 |
|
| 758 |
# Response:
|
|
@@ -770,7 +770,7 @@ curl -X POST http://localhost:8000/api/upload \
|
|
| 770 |
|
| 771 |
**Start Analysis:**
|
| 772 |
```bash
|
| 773 |
-
curl -X POST http://localhost:
|
| 774 |
|
| 775 |
# Response:
|
| 776 |
{
|
|
@@ -783,7 +783,7 @@ curl -X POST http://localhost:8000/api/analyze/550e8400-e29b-41d4-a716-446655440
|
|
| 783 |
|
| 784 |
**Get Results:**
|
| 785 |
```bash
|
| 786 |
-
curl http://localhost:
|
| 787 |
|
| 788 |
# Response:
|
| 789 |
{
|
|
|
|
| 188 |
|
| 189 |
# Edit .env with your preferences
|
| 190 |
# API_HOST=0.0.0.0
|
| 191 |
+
# API_PORT=7860
|
| 192 |
# DEBUG=false
|
| 193 |
# MAX_FILE_SIZE=104857600
|
| 194 |
```
|
|
|
|
| 199 |
python app/main.py
|
| 200 |
|
| 201 |
# Or use uvicorn directly
|
| 202 |
+
uvicorn app.main:app --host 0.0.0.0 --port 7860 --reload
|
| 203 |
```
|
| 204 |
|
| 205 |
#### **Step 5: Access Application**
|
| 206 |
+
- **Web Interface**: http://localhost:7860
|
| 207 |
+
- **API Documentation**: http://localhost:7860/api/docs
|
| 208 |
+
- **Health Check**: http://localhost:7860/health
|
| 209 |
|
| 210 |
### **b. Docker Deployment**
|
| 211 |
|
|
|
|
| 225 |
```
|
| 226 |
|
| 227 |
#### **Step 3: Access Application**
|
| 228 |
+
- **Web Interface**: http://localhost:7860
|
| 229 |
+
- **API Documentation**: http://localhost:7860/api/docs
|
| 230 |
|
| 231 |
#### **Step 4: Manage Services**
|
| 232 |
```bash
|
|
|
|
| 752 |
|
| 753 |
**Upload Video:**
|
| 754 |
```bash
|
| 755 |
+
curl -X POST http://localhost:7860/api/upload \
|
| 756 |
-F "file=@dance.mp4"
|
| 757 |
|
| 758 |
# Response:
|
|
|
|
| 770 |
|
| 771 |
**Start Analysis:**
|
| 772 |
```bash
|
| 773 |
+
curl -X POST http://localhost:7860/api/analyze/550e8400-e29b-41d4-a716-446655440000
|
| 774 |
|
| 775 |
# Response:
|
| 776 |
{
|
|
|
|
| 783 |
|
| 784 |
**Get Results:**
|
| 785 |
```bash
|
| 786 |
+
curl http://localhost:7860/api/results/550e8400-e29b-41d4-a716-446655440000
|
| 787 |
|
| 788 |
# Response:
|
| 789 |
{
|
startup.sh
CHANGED
|
@@ -5,7 +5,7 @@ echo "π Starting Dance Movement Analyzer..."
|
|
| 5 |
echo "π¦ MediaPipe models pre-downloaded during build"
|
| 6 |
|
| 7 |
# Detect port (Hugging Face uses 7860, local uses 8000)
|
| 8 |
-
PORT=${PORT:-
|
| 9 |
|
| 10 |
echo "π¬ Starting Uvicorn server on port $PORT..."
|
| 11 |
echo "π Application available at http://0.0.0.0:$PORT"
|
|
|
|
| 5 |
echo "π¦ MediaPipe models pre-downloaded during build"
|
| 6 |
|
| 7 |
# Detect port (Hugging Face uses 7860, local uses 8000)
|
| 8 |
+
PORT=${PORT:-7860}
|
| 9 |
|
| 10 |
echo "π¬ Starting Uvicorn server on port $PORT..."
|
| 11 |
echo "π Application available at http://0.0.0.0:$PORT"
|