File size: 3,206 Bytes
ef4a6ad
3a15d92
 
ef4a6ad
 
 
3a15d92
ef4a6ad
3a15d92
 
 
 
ef4a6ad
3a15d92
 
 
ef4a6ad
3a15d92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ef4a6ad
3a15d92
 
 
105aff1
3a15d92
 
 
 
 
 
 
 
 
 
 
 
ef4a6ad
3a15d92
 
 
105aff1
3a15d92
ef4a6ad
 
3a15d92
 
 
 
 
 
 
ef4a6ad
 
3a15d92
 
 
 
 
ef4a6ad
 
3a15d92
 
ef4a6ad
3a15d92
 
 
 
 
ef4a6ad
 
3a15d92
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
"""

Configuration settings for GATE Motion Analysis Gradio deployment.

Optimized for HuggingFace Spaces and similar cloud platforms.

"""

import os
from pathlib import Path

# Application settings
APP_NAME = "GATE Motion Analysis"
APP_VERSION = "2.0.0"
APP_DESCRIPTION = "GPU-optimized motion analysis for exercise form feedback"

# Server configuration
DEFAULT_PORT = 7860
DEFAULT_HOST = "0.0.0.0"

# Feature flags
ENABLE_DEBUG = os.getenv("DEBUG_MODE", "false").lower() == "true"
ENABLE_GPU = os.getenv("USE_GPU", "false").lower() == "true"
ENABLE_ANALYTICS = False  # Disabled to prevent tracking errors
ENABLE_API_DOCS = False   # Disabled to reduce overhead

# File upload limits
MAX_FILE_SIZE_MB = 50
SUPPORTED_VIDEO_FORMATS = [".mp4", ".avi", ".mov", ".mkv"]
SUPPORTED_IMAGE_FORMATS = [".jpg", ".jpeg", ".png", ".bmp", ".webp"]

# Exercise configuration
DEFAULT_EXERCISES = [
    "Squats",
    "Push-ups", 
    "Lunges",
    "Bicep Curls",
    "Deadlifts",
    "Planks",
    "Jumping Jacks"
]

# UI theme settings
UI_THEME = "soft"  # Options: "default", "soft", "glass", "monochrome"
UI_PRIMARY_COLOR = "#2563eb"
UI_SUCCESS_COLOR = "#059669"
UI_WARNING_COLOR = "#f59e0b"
UI_ERROR_COLOR = "#dc2626"

# Performance settings
MAX_CONCURRENT_USERS = 10
REQUEST_TIMEOUT_SECONDS = 30
ENABLE_QUEUE = False  # Disabled to prevent internal API calls
MAX_QUEUE_SIZE = 50

# Security settings
ALLOWED_ORIGINS = ["*"]  # Restrict in production
ENABLE_CORS = True
DISABLE_SSL_VERIFY = True  # For development only

# Gradio launch configuration
LAUNCH_CONFIG = {
    "server_name": DEFAULT_HOST,
    "server_port": int(os.getenv("PORT", DEFAULT_PORT)),
    "share": False,  # Disabled to prevent external service issues
    "show_error": True,
    "show_api": ENABLE_API_DOCS,
    "quiet": not ENABLE_DEBUG,
    "favicon_path": None,  # Prevents favicon 404 errors
    "max_threads": 1,  # Single thread to avoid concurrency issues
    "analytics_enabled": ENABLE_ANALYTICS
}

# Error messages
ERROR_MESSAGES = {
    "no_file": "Please upload a file to analyze",
    "invalid_format": "Unsupported file format. Please use JPG, PNG, or MP4",
    "file_too_large": f"File size exceeds {MAX_FILE_SIZE_MB}MB limit",
    "processing_error": "Error processing file. Please try again",
    "server_error": "Server error. Please contact support"
}

# Success messages
SUCCESS_MESSAGES = {
    "analysis_complete": "Analysis completed successfully",
    "upload_success": "File uploaded successfully",
    "system_ready": "System ready for analysis"
}

def get_app_info():
    """Get application information for display."""
    return {
        "name": APP_NAME,
        "version": APP_VERSION,
        "description": APP_DESCRIPTION,
        "debug_mode": ENABLE_DEBUG,
        "gpu_enabled": ENABLE_GPU
    }

def get_system_status():
    """Get current system status."""
    return {
        "status": "operational",
        "uptime": "N/A",  # Could be calculated from start time
        "memory_usage": "N/A",  # Could be calculated from system
        "cpu_usage": "N/A"  # Could be calculated from system
    }