Spaces:
Runtime error
Runtime error
Refactor to use username instead of access token
Browse files
app.py
CHANGED
|
@@ -100,23 +100,13 @@ with st.form(key="form"):
|
|
| 100 |
example_submission = json.load(f)
|
| 101 |
st.json(example_submission)
|
| 102 |
|
| 103 |
-
|
| 104 |
-
"Enter π€ Hub access token",
|
| 105 |
-
type="password",
|
| 106 |
-
help="You can generate an access token via your π€ Hub settings. See the [docs](https://huggingface.co/docs/hub/security#user-access-tokens) for more details",
|
| 107 |
-
)
|
| 108 |
-
if token:
|
| 109 |
-
try:
|
| 110 |
-
user_info = HfApi().whoami(token)
|
| 111 |
-
except Exception as e:
|
| 112 |
-
st.error("β Invalid access token")
|
| 113 |
-
submission_errors += 1
|
| 114 |
|
| 115 |
submit_button = st.form_submit_button("Make Submission")
|
| 116 |
|
| 117 |
if submit_button and submission_errors == 0:
|
| 118 |
st.write("β³ Preparing submission for evaluation ...")
|
| 119 |
-
user_name = user_info["name"]
|
| 120 |
submission_name = json_data["submission_name"]
|
| 121 |
submission_name_formatted = submission_name.lower().replace(" ", "-").replace("/", "-")
|
| 122 |
print(submission_name_formatted)
|
|
@@ -129,7 +119,7 @@ if submit_button and submission_errors == 0:
|
|
| 129 |
local_dir=LOCAL_REPO,
|
| 130 |
clone_from=dataset_repo_url,
|
| 131 |
repo_type="dataset",
|
| 132 |
-
private=
|
| 133 |
use_auth_token=HF_TOKEN,
|
| 134 |
)
|
| 135 |
submission_metadata = {"benchmark": "gem", "type": "prediction", "submission_name": submission_name}
|
|
@@ -189,6 +179,6 @@ if submit_button and submission_errors == 0:
|
|
| 189 |
else:
|
| 190 |
st.error("π Oh noes, there was an error submitting your submission! Please contact the organisers")
|
| 191 |
|
| 192 |
-
# Flush local
|
| 193 |
shutil.rmtree(LOCAL_REPO, ignore_errors=True)
|
| 194 |
shutil.rmtree(LOGS_REPO, ignore_errors=True)
|
|
|
|
| 100 |
example_submission = json.load(f)
|
| 101 |
st.json(example_submission)
|
| 102 |
|
| 103 |
+
user_name = st.text_input("Enter your π€ Hub username")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
submit_button = st.form_submit_button("Make Submission")
|
| 106 |
|
| 107 |
if submit_button and submission_errors == 0:
|
| 108 |
st.write("β³ Preparing submission for evaluation ...")
|
| 109 |
+
# user_name = user_info["name"]
|
| 110 |
submission_name = json_data["submission_name"]
|
| 111 |
submission_name_formatted = submission_name.lower().replace(" ", "-").replace("/", "-")
|
| 112 |
print(submission_name_formatted)
|
|
|
|
| 119 |
local_dir=LOCAL_REPO,
|
| 120 |
clone_from=dataset_repo_url,
|
| 121 |
repo_type="dataset",
|
| 122 |
+
private=False,
|
| 123 |
use_auth_token=HF_TOKEN,
|
| 124 |
)
|
| 125 |
submission_metadata = {"benchmark": "gem", "type": "prediction", "submission_name": submission_name}
|
|
|
|
| 179 |
else:
|
| 180 |
st.error("π Oh noes, there was an error submitting your submission! Please contact the organisers")
|
| 181 |
|
| 182 |
+
# Flush local repos
|
| 183 |
shutil.rmtree(LOCAL_REPO, ignore_errors=True)
|
| 184 |
shutil.rmtree(LOGS_REPO, ignore_errors=True)
|