Yabuku-xD commited on
Commit
ff04eab
·
1 Parent(s): 6d84838

Fix dataset authentication

Browse files
Files changed (1) hide show
  1. server.py +14 -5
server.py CHANGED
@@ -17,7 +17,12 @@ FILES_TO_DOWNLOAD = [
17
  ]
18
 
19
  def download_artifacts():
20
- print(f"Checking for data files from {DATASET_ID}...")
 
 
 
 
 
21
  for filename in FILES_TO_DOWNLOAD:
22
  if not os.path.exists(filename):
23
  print(f"Downloading {filename}...")
@@ -26,12 +31,16 @@ def download_artifacts():
26
  repo_id=DATASET_ID,
27
  filename=filename,
28
  repo_type="dataset",
29
- local_dir="."
 
30
  )
31
- print(f"Downloaded {filename}")
32
  except Exception as e:
33
- print(f"Failed to download {filename}: {e}")
34
- print("Make sure the file exists in your Hugging Face Dataset!")
 
 
 
35
 
36
  download_artifacts()
37
 
 
17
  ]
18
 
19
  def download_artifacts():
20
+ token = os.environ.get("HF_TOKEN")
21
+
22
+ print(f"--- STARTING DOWNLOAD ---")
23
+ print(f"Target Dataset: {DATASET_ID}")
24
+ print(f"Token Found: {'Yes' if token else 'No'}")
25
+
26
  for filename in FILES_TO_DOWNLOAD:
27
  if not os.path.exists(filename):
28
  print(f"Downloading {filename}...")
 
31
  repo_id=DATASET_ID,
32
  filename=filename,
33
  repo_type="dataset",
34
+ local_dir=".",
35
+ token=token
36
  )
37
+ print(f"✅ Downloaded {filename}")
38
  except Exception as e:
39
+ print(f"❌ CRITICAL ERROR: Failed to download {filename}")
40
+ print(f"Error details: {e}")
41
+ print("HINT: Is the Dataset Name correct? Is it Private? (If private, the Space needs a token)")
42
+ else:
43
+ print(f"✅ Found existing {filename}")
44
 
45
  download_artifacts()
46