Spaces:
Sleeping
Sleeping
""" | |
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 | |
} |