Spaces:
Sleeping
Sleeping
| from pathlib import Path | |
| from pydantic_settings import BaseSettings | |
| class Settings(BaseSettings): | |
| # Application | |
| app_name: str = "Biomass Prediction API" | |
| model_name: str = "convnextv2_pico.fcmae" | |
| img_size: int = 384 | |
| # ------------------------------------------------------------------ | |
| # Paths | |
| # ------------------------------------------------------------------ | |
| # Repository root (/app in Hugging Face Docker Spaces) | |
| base_dir: Path = Path(__file__).resolve().parent.parent.parent | |
| # Persistent storage mount in Hugging Face Spaces | |
| data_dir: Path = Path("/data") | |
| # Model directories | |
| aux_model_dir: Path = data_dir / "Models_Aux_Only" | |
| main_model_dir: Path = data_dir / "Models_Seeded_Ensemble" | |
| # ------------------------------------------------------------------ | |
| # Inference Configuration | |
| # ------------------------------------------------------------------ | |
| targets: list[str] = [ | |
| "Dry_Green_g", | |
| "Dry_Dead_g", | |
| "Dry_Clover_g", | |
| "GDM_g", | |
| "Dry_Total_g", | |
| ] | |
| fold_weights: dict[int, float] = { | |
| 0: 0.2, | |
| 1: 0.2, | |
| 2: 0.2, | |
| 3: 0.2, | |
| 4: 0.2, | |
| } | |
| seeds: list[int] = [42] | |
| aux_seeds: list[int] = [44] | |
| class Config: | |
| env_file = ".env" | |
| settings = Settings() | |
| # Optional debug logs | |
| if __name__ == "__main__": | |
| print("Base Directory:", settings.base_dir) | |
| print("Data Directory:", settings.data_dir) | |
| print("Aux Models:", settings.aux_model_dir) | |
| print("Main Models:", settings.main_model_dir) | |
| print("Aux Exists:", settings.aux_model_dir.exists()) | |
| print("Main Exists:", settings.main_model_dir.exists()) |