File size: 3,762 Bytes
2ec0d39 5d2662c 2ec0d39 |
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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# 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'"] |