olivas/backend/app/config.py
DJP 3467dbcf03 Initial commit — OliVAS visual attention analysis platform
Full-stack application for predicting where humans look in images using
DeepGaze saliency models. Includes heatmap overlays, gaze sequence prediction,
hotspot detection, AOI analysis, rule-based insights, optional Claude AI
design analysis, and professional PDF report generation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 20:20:58 -05:00

30 lines
889 B
Python

from pydantic_settings import BaseSettings
class Settings(BaseSettings):
DATABASE_URL: str = "postgresql+asyncpg://olivas:olivas@localhost:5453/olivas"
UPLOAD_DIR: str = "./data/uploads"
DEVICE: str = "auto" # auto | cpu | cuda
ANTHROPIC_API_KEY: str = ""
CORS_ORIGINS: str = "http://localhost:1577"
BACKEND_HOST: str = "0.0.0.0"
BACKEND_PORT: int = 8000
@property
def device(self) -> str:
if self.DEVICE == "auto":
try:
import torch
return "cuda" if torch.cuda.is_available() else "cpu"
except ImportError:
return "cpu"
return self.DEVICE
@property
def cors_origins_list(self) -> list[str]:
return [o.strip() for o in self.CORS_ORIGINS.split(",")]
model_config = {"env_file": ".env", "env_file_encoding": "utf-8"}
settings = Settings()