davanstrien HF Staff commited on
Commit
a546a29
·
1 Parent(s): 12fb23c

Fix: Update dataset download path for compatibility with HF_HOME environment variable

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -65,8 +65,10 @@ _model_cache: dict = {}
65
  def get_lance_dataset():
66
  """Download dataset from HF Hub (cached) and return Lance connection."""
67
  if "ds" not in _lance_cache:
68
- # Use local_dir to get actual files, not symlinks (Lance needs real files)
69
- local_dir = "./data/arxiv-lance"
 
 
70
  print(f"Downloading dataset from {DATASET_REPO} to {local_dir}...")
71
  snapshot_download(
72
  DATASET_REPO,
 
65
  def get_lance_dataset():
66
  """Download dataset from HF Hub (cached) and return Lance connection."""
67
  if "ds" not in _lance_cache:
68
+ import os
69
+ # Use HF_HOME or /tmp for Spaces compatibility (./data not writable on Spaces)
70
+ cache_base = os.environ.get("HF_HOME", "/tmp/hf_cache")
71
+ local_dir = f"{cache_base}/arxiv-lance"
72
  print(f"Downloading dataset from {DATASET_REPO} to {local_dir}...")
73
  snapshot_download(
74
  DATASET_REPO,