saraht14 commited on
Commit
b230e79
·
verified ·
1 Parent(s): a3c54ef

checking read token

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -21,7 +21,7 @@ from huggingface_hub import login
21
  import requests
22
  import matplotlib
23
  matplotlib.use("Agg")
24
-
25
  def fetch_required_files(exp_config):
26
  # os.makedirs("temp_data", exist_ok=True)
27
  for key in exp_config:
@@ -260,8 +260,8 @@ def evaluate_model(username, file):
260
 
261
  exp = read_configuration("metadata.csv")
262
  print(f"FIRST: {len(exp)}")
263
- exp = fetch_required_files(exp)
264
- print(f"SECOND: {len(exp)}")
265
 
266
  start_time = time.time()
267
  stats_model_sectors = []
@@ -279,9 +279,12 @@ def evaluate_model(username, file):
279
  # filename_url = f"https://saraht14-server.hf.space/file/{filename}"
280
  # local_txt_path = f"./{filename}.txt"
281
  # os.makedirs("temp_data", exist_ok=True)
282
- local_file_path = exp[key]["local_file"]
283
  # downloaded = download_file(filename_url, local_txt_path)
284
-
 
 
 
285
  # if not downloaded:
286
  # raise Exception("Failed to fetch remote file.")
287
  # sectors_model = subprocess.run(["python", script_path,filename], capture_output=True, text=True, timeout=300)
 
21
  import requests
22
  import matplotlib
23
  matplotlib.use("Agg")
24
+ READ_TOKEN = os.environ.get("read_token")
25
  def fetch_required_files(exp_config):
26
  # os.makedirs("temp_data", exist_ok=True)
27
  for key in exp_config:
 
260
 
261
  exp = read_configuration("metadata.csv")
262
  print(f"FIRST: {len(exp)}")
263
+ # exp = fetch_required_files(exp)
264
+ # print(f"SECOND: {len(exp)}")
265
 
266
  start_time = time.time()
267
  stats_model_sectors = []
 
279
  # filename_url = f"https://saraht14-server.hf.space/file/{filename}"
280
  # local_txt_path = f"./{filename}.txt"
281
  # os.makedirs("temp_data", exist_ok=True)
282
+ # local_file_path = exp[key]["local_file"]
283
  # downloaded = download_file(filename_url, local_txt_path)
284
+ local_file_path = hf_hub_download(repo_id="IndoorOutdoor/metadata",
285
+ filename=filename,
286
+ repo_type="dataset",
287
+ token=READ_TOKEN)
288
  # if not downloaded:
289
  # raise Exception("Failed to fetch remote file.")
290
  # sectors_model = subprocess.run(["python", script_path,filename], capture_output=True, text=True, timeout=300)