MLGraph-Bitcoin-GAD / config.py
thanhphxu's picture
Upload folder using huggingface_hub
db886e4 verified
import os
from dataclasses import dataclass
@dataclass
class AppConfig:
# --- Hugging Face model repos (set via environment variables on Spaces) ---
HF_GAT_BASELINE_REPO: str = os.getenv("HF_GAT_BASELINE_REPO", "org/name_gat_baseline")
HF_GATV2_REPO: str = os.getenv("HF_GATV2_REPO", "org/name_gatv2")
# Expected input dim of Elliptic-trained models (given by user)
IN_CHANNELS: int = int(os.getenv("IN_CHANNELS", "165"))
HIDDEN_CHANNELS: int = int(os.getenv("HIDDEN_CHANNELS", "128"))
HEADS: int = int(os.getenv("HEADS", "8"))
NUM_BLOCKS: int = int(os.getenv("NUM_BLOCKS", "2"))
DROPOUT: float = float(os.getenv("DROPOUT", "0.5"))
# Data providers
DATA_PROVIDER: str = os.getenv("DATA_PROVIDER", "mempool") # mempool | blockstream | blockchair
HTTP_TIMEOUT: int = int(os.getenv("HTTP_TIMEOUT", "10"))
HTTP_RETRIES: int = int(os.getenv("HTTP_RETRIES", "2"))
# Graph limits (safeguard)
MAX_NODES: int = int(os.getenv("MAX_NODES", "5000"))
MAX_EDGES: int = int(os.getenv("MAX_EDGES", "15000"))
# Feature handling
USE_FEATURE_ADAPTER: bool = os.getenv("USE_FEATURE_ADAPTER", "true").lower() == "true"
MAKE_UNDIRECTED: bool = os.getenv("MAKE_UNDIRECTED", "false").lower() == "true"
# Threshold fallback
DEFAULT_THRESHOLD: float = float(os.getenv("DEFAULT_THRESHOLD", "0.5"))
# Rate limit
MAX_CALLS_PER_MIN: int = int(os.getenv("MAX_CALLS_PER_MIN", "20"))
WINDOW_SECONDS: int = int(os.getenv("WINDOW_SECONDS", "60"))
# Queue config
QUEUE_CONCURRENCY: int = int(os.getenv("QUEUE_CONCURRENCY", "2"))
# Blockchair API key (optional)
BLOCKCHAIR_API_KEY: str = os.getenv("BLOCKCHAIR_API_KEY", "").strip()