Update app.py
Browse filesCommenting the instructions related to cloning and updating username repo.
app.py
CHANGED
@@ -16,11 +16,11 @@ HF_TOKEN = os.environ.get("HF_TOKEN")
|
|
16 |
|
17 |
usernames_url = os.path.join("https://huggingface.co/datasets", USERNAMES_DATASET_ID)
|
18 |
|
19 |
-
usernames_repo = Repository(local_dir="usernames", clone_from=usernames_url, use_auth_token=HF_TOKEN)
|
20 |
-
usernames_repo.git_pull()
|
21 |
|
22 |
-
CSV_RESULTS_FILE = os.path.join("usernames", "usernames.csv")
|
23 |
-
all_results = read_csv(CSV_RESULTS_FILE)
|
24 |
|
25 |
# load the LID checkpoint
|
26 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
@@ -58,8 +58,8 @@ def verify_demo(repo_id):
|
|
58 |
if len(split_repo_id) > 2:
|
59 |
repo_id = "/".join(split_repo_id[-2:])
|
60 |
|
61 |
-
if (all_results["username"] == user_name).any():
|
62 |
-
|
63 |
|
64 |
try:
|
65 |
client = Client(repo_id, hf_token=HF_TOKEN)
|
@@ -96,9 +96,9 @@ def verify_demo(repo_id):
|
|
96 |
)
|
97 |
|
98 |
# save and upload new evaluated usernames
|
99 |
-
all_results.loc[len(all_results)] = {"username": user_name}
|
100 |
-
all_results.to_csv(CSV_RESULTS_FILE, index=False)
|
101 |
-
usernames_repo.push_to_hub()
|
102 |
|
103 |
message = PASS_MESSAGE.replace("USER", user_name)
|
104 |
|
|
|
16 |
|
17 |
usernames_url = os.path.join("https://huggingface.co/datasets", USERNAMES_DATASET_ID)
|
18 |
|
19 |
+
#usernames_repo = Repository(local_dir="usernames", clone_from=usernames_url, use_auth_token=HF_TOKEN)
|
20 |
+
#usernames_repo.git_pull()
|
21 |
|
22 |
+
#CSV_RESULTS_FILE = os.path.join("usernames", "usernames.csv")
|
23 |
+
#all_results = read_csv(CSV_RESULTS_FILE)
|
24 |
|
25 |
# load the LID checkpoint
|
26 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
|
58 |
if len(split_repo_id) > 2:
|
59 |
repo_id = "/".join(split_repo_id[-2:])
|
60 |
|
61 |
+
#if (all_results["username"] == user_name).any():
|
62 |
+
# raise gr.Error(f"Username {user_name} has already passed the assessment!")
|
63 |
|
64 |
try:
|
65 |
client = Client(repo_id, hf_token=HF_TOKEN)
|
|
|
96 |
)
|
97 |
|
98 |
# save and upload new evaluated usernames
|
99 |
+
#all_results.loc[len(all_results)] = {"username": user_name}
|
100 |
+
#all_results.to_csv(CSV_RESULTS_FILE, index=False)
|
101 |
+
#usernames_repo.push_to_hub()
|
102 |
|
103 |
message = PASS_MESSAGE.replace("USER", user_name)
|
104 |
|