Spaces:
Running
on
Zero
Running
on
Zero
| # HuggingFace Spaces Configuration | |
| # This file defines the Spaces deployment settings | |
| title: "Secure AI Agents Suite" | |
| sdk: "gradio" | |
| sdk_version: "4.0.0" | |
| # Hardware requirements and optimization | |
| hardware: "cpu-basic" # Options: cpu-basic, cpu-upgrade, gpu-t4, gpu-a10g, gpu-a100 | |
| init_timeout: 600 # 10 minutes for model loading | |
| hf_transfer: true # Enable HuggingFace model transfer acceleration | |
| # Build and runtime configuration | |
| build_command: | | |
| pip install --upgrade pip setuptools wheel | |
| pip install -r requirements.txt | |
| pip cache purge | |
| run_command: | | |
| python app.py | |
| error_message: | | |
| Failed to initialize application. Please check logs and try again. | |
| Common solutions: | |
| 1. Verify all dependencies are installed | |
| 2. Check memory availability | |
| 3. Review app.py for syntax errors | |
| 4. Contact support if issue persists | |
| # Gradio server settings | |
| gradio_share: false | |
| gradio_server_name: "0.0.0.0" | |
| gradio_server_port: 7860 | |
| gradio_server_headless: true | |
| gradio_show_error: true | |
| gradio_concurrency_count: 5 # Maximum concurrent users | |
| gradio_max_threads: 10 # Maximum thread pool size | |
| # Environment variables | |
| env: | |
| - HF_HUB_ENABLE_HF_TRANSFER: "1" | |
| - HF_HOME: "/tmp/cache" | |
| - TRANSFORMERS_CACHE: "/tmp/cache" | |
| - HF_HUB_CACHE: "/tmp/cache" | |
| - PYTHONUNBUFFERED: "1" | |
| - PIP_NO_CACHE_DIR: "1" | |
| - PIP_DISABLE_PIP_VERSION_CHECK: "1" | |
| # Secrets and variables (defined in Spaces settings) | |
| # secrets: | |
| # - OPENAI_API_KEY | |
| # - ANTHROPIC_API_KEY | |
| # - GOOGLE_API_KEY | |
| # Tags for discovery and categorization | |
| tags: | |
| - ai-agents | |
| - autonomous-planning | |
| - machine-learning | |
| - gradio | |
| - spaces | |
| - python | |
| - nlp | |
| - task-automation | |
| - security | |
| - analytics | |
| # Widgets configuration (if using custom widgets) | |
| # widgets: | |
| # - type: "text" | |
| # name: "user_input" | |
| # label: "Your Request" | |
| # - type: "dropdown" | |
| # name: "agent_type" | |
| # label: "Agent Type" | |
| # Additional metadata | |
| license: "mit" | |
| language: ["python"] | |
| library: ["gradio"] | |
| # Scale and performance | |
| scale: | |
| min_replicas: 1 | |
| max_replicas: 10 | |
| target_cpu_utilization_percentage: 70 | |
| # Health check configuration | |
| health_check: | |
| path: "/health" | |
| initial_delay_seconds: 30 | |
| period_seconds: 30 | |
| timeout_seconds: 10 | |
| failure_threshold: 3 | |
| success_threshold: 1 | |
| # Security settings | |
| security: | |
| allow_origins: ["*"] # Configure for production | |
| rate_limit: 100 # requests per minute | |
| cors_enabled: true | |
| # Caching configuration | |
| caching: | |
| enabled: true | |
| ttl: 3600 # 1 hour cache TTL | |
| max_size: 1000 # Maximum cached items | |
| # Monitoring and logging | |
| monitoring: | |
| enabled: true | |
| level: "INFO" | |
| retention_days: 7 | |
| metrics_enabled: true | |
| # Performance tuning | |
| performance: | |
| worker_processes: 1 | |
| worker_threads: 10 | |
| max_request_size: "10MB" | |
| request_timeout: 300 | |
| keepalive_timeout: 65 | |
| # Resource limits | |
| resources: | |
| memory_limit: "2Gi" | |
| cpu_limit: "2000m" | |
| ephemeral_storage_limit: "10Gi" | |
| # Auto-scaling configuration | |
| autoscaling: | |
| enabled: true | |
| min_replicas: 1 | |
| max_replicas: 5 | |
| target_cpu_utilization_percentage: 70 | |
| target_memory_utilization_percentage: 80 | |
| # Backup and disaster recovery | |
| backup: | |
| enabled: true | |
| frequency: "daily" | |
| retention_days: 30 | |
| # Custom headers for API responses | |
| headers: | |
| X-Content-Type-Options: "nosniff" | |
| X-Frame-Options: "DENY" | |
| X-XSS-Protection: "1; mode=block" | |
| Strict-Transport-Security: "max-age=31536000; includeSubDomains" | |
| # Content Security Policy | |
| csp: | |
| default_src: ["'self'"] | |
| script_src: ["'self'", "'unsafe-inline'"] | |
| style_src: ["'self'", "'unsafe-inline'"] | |
| img_src: ["'self'", "data:", "https:"] | |
| connect_src: ["'self'", "https:", "wss:"] | |
| font_src: ["'self'", "https:", "data:"] | |
| object_src: ["'none'"] | |
| media_src: ["'self'"] | |
| frame_src: ["'none'"] |