Spaces:
Running
on
A10G
Running
on
A10G
add oauth token validation before running
Browse files
app.py
CHANGED
@@ -117,6 +117,13 @@ def split_upload_model(model_path: str, outdir: str, repo_id: str, oauth_token:
|
|
117 |
def process_model(model_id, q_method, use_imatrix, imatrix_q_method, private_repo, train_data_file, split_model, split_max_tensors, split_max_size, oauth_token: gr.OAuthToken | None):
|
118 |
if oauth_token is None or oauth_token.token is None:
|
119 |
raise gr.Error("You must be logged in to use GGUF-my-repo")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
model_name = model_id.split('/')[-1]
|
121 |
|
122 |
try:
|
|
|
117 |
def process_model(model_id, q_method, use_imatrix, imatrix_q_method, private_repo, train_data_file, split_model, split_max_tensors, split_max_size, oauth_token: gr.OAuthToken | None):
|
118 |
if oauth_token is None or oauth_token.token is None:
|
119 |
raise gr.Error("You must be logged in to use GGUF-my-repo")
|
120 |
+
|
121 |
+
# validate the oauth token
|
122 |
+
try:
|
123 |
+
whoami(oauth_token.token)
|
124 |
+
except Exception as e:
|
125 |
+
raise gr.Error("You must be logged in to use GGUF-my-repo")
|
126 |
+
|
127 |
model_name = model_id.split('/')[-1]
|
128 |
|
129 |
try:
|