deepfake / environment-variable-template.env
Thiru1122's picture
Deploy Gradio Deepfake Detection inference backend to Hugging Face Spaces
497f4c9
Raw History Blame Contribute Delete
3.12 kB
# ==============================================================================
# DEEPFAKE DETECTION APPLICATION - ENVIRONMENT VARIABLE TEMPLATE
# ==============================================================================
# Copy this file to .env before running or deploying.
# Do not commit the populated .env file containing production secrets to version control.
# ------------------------------------------------------------------------------
# 1. SERVER & RUNTIME CONFIGURATION
# ------------------------------------------------------------------------------
# The port on which Flask / Gunicorn binds (Hugging Face Spaces default: 7860)
PORT=7860
# Host address (0.0.0.0 is mandatory for Docker and cloud containers)
HOST=0.0.0.0
# Flask environment: 'production' or 'development'
FLASK_ENV=production
# Set to 0 in production to disable the interactive Werkzeug debugger
FLASK_DEBUG=0
# Secret key for session management and form security (generate with: openssl rand -hex 32)
SECRET_KEY=change-this-to-a-secure-random-32-byte-hex-string
# ------------------------------------------------------------------------------
# 2. CORS & DOMAIN SECURITY
# ------------------------------------------------------------------------------
# Comma-separated list of allowed origins (e.g., https://my-frontend.vercel.app)
# Use * only during local development testing.
CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000,http://localhost:5173,http://127.0.0.1:5173
# ------------------------------------------------------------------------------
# 3. MODEL PATHS & HARDWARE EXECUTION
# ------------------------------------------------------------------------------
# Computation device: 'cpu' or 'cuda' (automatically falls back to cpu if cuda is unavailable)
DEEPFAKE_DEVICE=cpu
# Path to the PyTorch Video Model checkpoint (ResNeXt-50 + LSTM)
VIDEO_MODEL_PATH=model/df_model.pt
# Path to the Hugging Face ViT Image Model directory
DEEPFAKE_MODEL_PATH=deepfake-detector-model-v1-main/models/deepfake_vs_real_image_detection
# ------------------------------------------------------------------------------
# 4. STORAGE & UPLOAD LIMITS
# ------------------------------------------------------------------------------
# Directory where uploaded files are temporarily buffered during inference
UPLOAD_FOLDER=Uploaded_Files
# Maximum allowed file upload size in bytes (e.g., 50 MB = 52428800)
MAX_CONTENT_LENGTH=52428800
# ------------------------------------------------------------------------------
# 5. FRONTEND INTEGRATION (For standalone React / Netlify / Vercel frontends)
# ------------------------------------------------------------------------------
# Gradio Space API Base URL consumed by the standalone React application on Netlify / Vercel.
# If frontend is served directly by the backend / locally, leave empty ('').
# If frontend is hosted independently on Netlify or Vercel, set to your Hugging Face Space URL:
# Example: REACT_APP_GRADIO_SPACE_URL=https://username-deepfake-detection.hf.space
REACT_APP_GRADIO_SPACE_URL=
# Vite fallback for alternative build setups:
VITE_API_BASE_URL=