Spaces:
Sleeping
Sleeping
Update app/core/hf_client.py
Browse files1234567891011121314151617181920212223242526272829import timeimport pandas as pdfrom fastapi import HTTPExceptionfrom huggingface_hub import hf_hub_downloadfrom app.core.config import Configfrom app.core.cache import get_cache, set_cache
def download_latest_csv(force=False, retry=3): cached = get_cache(Config.CACHE_TTL) if cached is not None and not force: return cached
for attempt in range(retry): try: path = hf_hub_download( repo_id=Config.HF_DATASET_REPO, filename=Config.PRED_LATEST, repo_type="dataset", token=Config.HF_TOKEN, force_download=True, ) df = pd.read_csv(path) set_cache(df) return df except Exception as e: if attempt == retry - 1: raise HTTPException(503, f"Dataset erişilemedi: {e}") time.sleep(2) return pd.DataFrame()app/core/hf_client.py+29