| | """ |
| | Configuration management for the FastAPI application. |
| | """ |
| |
|
| | import os |
| | from typing import Optional |
| | from pydantic_settings import BaseSettings |
| |
|
| |
|
| | class Settings(BaseSettings): |
| | """Application settings.""" |
| | |
| | |
| | API_V1_STR: str = "/api/v1" |
| | PROJECT_NAME: str = "Seamo Species API" |
| | VERSION: str = "1.0.0" |
| | DESCRIPTION: str = "FastAPI-based species identification using YOLOv5" |
| | |
| | |
| | MODEL_NAME: str = "marina-benthic-33k" |
| | MODEL_PATH: str = "models/marina-benthic-33k.pt" |
| | HUGGINGFACE_REPO: str = "seamo-ai/marina-species-v1" |
| | DEVICE: Optional[str] = None |
| | |
| | |
| | DEFAULT_CONFIDENCE_THRESHOLD: float = 0.25 |
| | DEFAULT_IOU_THRESHOLD: float = 0.45 |
| | DEFAULT_IMAGE_SIZE: int = 720 |
| | MAX_IMAGE_SIZE: int = 1280 |
| | MIN_IMAGE_SIZE: int = 320 |
| | |
| | |
| | MAX_FILE_SIZE: int = 10 * 1024 * 1024 |
| | ALLOWED_EXTENSIONS: set = {".jpg", ".jpeg", ".png", ".bmp", ".tiff", ".webp"} |
| | |
| | |
| | MODEL_CACHE_SIZE: int = 1 |
| | ENABLE_MODEL_WARMUP: bool = True |
| | |
| | |
| | HF_HUB_OFFLINE: bool = os.getenv("HF_HUB_OFFLINE", "0") == "1" |
| | TRANSFORMERS_NO_ADVISORY_WARNINGS: bool = True |
| | |
| | |
| | HOST: str = "0.0.0.0" |
| | PORT: int = 7860 |
| |
|
| | |
| | DEBUG: bool = False |
| |
|
| | class Config: |
| | env_file = ".env" |
| | case_sensitive = True |
| | extra = "ignore" |
| |
|
| |
|
| | |
| | settings = Settings() |
| |
|