File size: 883 Bytes
6e7ce87
 
 
 
 
 
81516f3
6e7ce87
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81516f3
6e7ce87
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
from dataclasses import dataclass

@dataclass
class AppConfig:
    """
    Central configuration for the Tabular Agentic XAI app.
    """
    # Common
    hf_model_repo: str
    sql_backend: str  # "bigquery" or "motherduck"

    # BigQuery
    gcp_project: str | None = None

    # MotherDuck
    motherduck_db: str | None = None
    motherduck_token: str | None = None

    @classmethod
    def from_env(cls):
        """
        Reads env vars from .env (local) or Space Secrets (HF Spaces).
        """
        return cls(
            hf_model_repo=os.getenv("HF_MODEL_REPO", "your-username/your-private-tabular-model"),
            sql_backend=os.getenv("SQL_BACKEND", "motherduck"),
            gcp_project=os.getenv("GCP_PROJECT"),
            motherduck_db=os.getenv("MOTHERDUCK_DB", "default"),
            motherduck_token=os.getenv("MOTHERDUCK_TOKEN")
        )