veo3/backend/config.py
2025-11-15 06:00:07 +05:30

70 lines
No EOL
3.2 KiB
Python

import os
from dotenv import load_dotenv
load_dotenv()
class Config:
# Google Cloud Configuration
PROJECT_ID = os.getenv('PROJECT_ID', 'optical-414516')
REGION = os.getenv('REGION', 'us-central1')
MODEL_ID = os.getenv('MODEL_ID', 'veo-3.1-generate-preview')
MODEL_FAST_ID = os.getenv('MODEL_FAST_ID', 'veo-3.1-fast-generate-preview')
OUTPUT_GCS_BUCKET_NAME = os.getenv('OUTPUT_GCS_BUCKET_NAME', 'optical-veo3-test')
SERVICE_ACCOUNT_KEY_PATH = os.getenv('SERVICE_ACCOUNT_KEY_PATH', '../service-account.json')
# Model configurations - Veo 3.1 Only
SUPPORTED_MODELS = {
'veo-3.1-generate-preview': {
'name': 'Veo 3.1 Standard',
'description': 'High-quality with reference images & frame interpolation',
'price_per_second': 0.40,
'speed': 'Standard',
'supports_reference_images': True,
'supports_last_frame': True,
'supports_video_extension': True
},
'veo-3.1-fast-generate-preview': {
'name': 'Veo 3.1 Fast',
'description': 'Optimized speed with frame interpolation',
'price_per_second': 0.15,
'speed': 'Fast',
'supports_reference_images': False, # Reference images NOT supported in Fast model
'supports_last_frame': True,
'supports_video_extension': True
}
}
# Flask Configuration
SECRET_KEY = os.getenv('SECRET_KEY', 'dev-secret-key-change-in-production')
FLASK_ENV = os.getenv('FLASK_ENV', 'production')
FLASK_DEBUG = os.getenv('FLASK_DEBUG', 'False').lower() in ['true', '1', 'yes']
PORT = int(os.getenv('PORT', 7394))
# CORS Configuration
FRONTEND_URL = os.getenv('FRONTEND_URL', 'https://ai-sandbox.oliver.solutions')
# Development mode
IS_DEVELOPMENT = FLASK_ENV == 'development'
# Temp storage configuration
TEMP_DOWNLOAD_PATH = os.path.abspath("./temp_downloads/")
# Image upload configuration
TEMP_IMAGE_GCS_PATH = "temp_images"
MAX_IMAGE_SIZE = 10 * 1024 * 1024 # 10MB
# Note: All Pillow-supported formats are accepted and automatically converted to JPEG
SUPPORTED_IMAGE_FORMATS = ['JPEG', 'PNG', 'JPG', 'GIF', 'BMP', 'TIFF', 'WEBP', 'ICO']
SUPPORTED_IMAGE_EXTENSIONS = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff', '.tif', '.webp', '.ico']
MIN_IMAGE_RESOLUTION = (720, 720) # Minimum 720p
SUPPORTED_ASPECT_RATIOS = ['16:9', '9:16']
# Webhook Configuration
WEBHOOK_URL = os.getenv('WEBHOOK_URL', 'https://hook.us1.make.celonis.com/8ri1h8b2he4wudp2jku69mgcxumzxf3v')
WEBHOOK_ENABLED = os.getenv('WEBHOOK_ENABLED', 'true').lower() in ['true', '1', 'yes']
WEBHOOK_TIMEOUT = int(os.getenv('WEBHOOK_TIMEOUT', 10)) # seconds
# File Cleanup Configuration
CLEANUP_DELAY_SMALL_FILES = int(os.getenv('CLEANUP_DELAY_SMALL_FILES', 15)) # seconds
CLEANUP_DELAY_LARGE_FILES = int(os.getenv('CLEANUP_DELAY_LARGE_FILES', 30)) # seconds
LARGE_FILE_THRESHOLD = int(os.getenv('LARGE_FILE_THRESHOLD', 100)) * 1024 * 1024 # MB to bytes
CLEANUP_GCS_BY_DEFAULT = os.getenv('CLEANUP_GCS_BY_DEFAULT', 'true').lower() in ['true', '1', 'yes']