Fetch usernames for U7 each time space is called

#1
by sanchit-gandhi HF staff - opened
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -18,7 +18,6 @@ def pass_emoji(passed):
18
  api = HfApi()
19
  USERNAMES_DATASET_ID = "huggingface-course/audio-course-u7-hands-on"
20
  HF_TOKEN = os.environ.get("HF_TOKEN")
21
- U7_USERNAMES = hf_hub_download(USERNAMES_DATASET_ID, repo_type = "dataset", filename="usernames.csv", token=HF_TOKEN)
22
 
23
 
24
  def get_user_models(hf_username, task):
@@ -201,7 +200,8 @@ def certification(hf_username):
201
  unit["passed"] = pass_emoji(unit["passed_"])
202
  except: print("Either no relevant models found, or no metrics in the model card for automatic speech recognition")
203
  case "demo":
204
- u7_users = pd.read_csv(U7_USERNAMES)
 
205
  if hf_username in u7_users['username']:
206
  unit["best_result"] = 0
207
  unit["best_model_id"] = "Demo check passed, no model id"
 
18
  api = HfApi()
19
  USERNAMES_DATASET_ID = "huggingface-course/audio-course-u7-hands-on"
20
  HF_TOKEN = os.environ.get("HF_TOKEN")
 
21
 
22
 
23
  def get_user_models(hf_username, task):
 
200
  unit["passed"] = pass_emoji(unit["passed_"])
201
  except: print("Either no relevant models found, or no metrics in the model card for automatic speech recognition")
202
  case "demo":
203
+ u7_usernames = hf_hub_download(USERNAMES_DATASET_ID, repo_type = "dataset", filename="usernames.csv", token=HF_TOKEN)
204
+ u7_users = pd.read_csv(u7_usernames)
205
  if hf_username in u7_users['username']:
206
  unit["best_result"] = 0
207
  unit["best_model_id"] = "Demo check passed, no model id"