Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -103,7 +103,7 @@ def upload_to_hub(path, upload_repo, hf_path, token):
|
|
103 |
|
104 |
def process_model(model_id, q_method, oauth_token: gr.OAuthToken | None):
|
105 |
if oauth_token is None or oauth_token.token is None:
|
106 |
-
raise gr.Error("You must be logged in to use MLX-my-repo"
|
107 |
|
108 |
token = oauth_token.token
|
109 |
# Verify the token
|
@@ -113,7 +113,7 @@ def process_model(model_id, q_method, oauth_token: gr.OAuthToken | None):
|
|
113 |
username = user_info["name"]
|
114 |
print(f"✅ Logged in as {username}")
|
115 |
except Exception as e:
|
116 |
-
raise gr.Error(f"❌ Authentication failed: {e}"
|
117 |
|
118 |
try:
|
119 |
model_name = model_id.split('/')[-1]
|
@@ -145,8 +145,7 @@ def process_model(model_id, q_method, oauth_token: gr.OAuthToken | None):
|
|
145 |
"llama.png",
|
146 |
)
|
147 |
except Exception as e:
|
148 |
-
|
149 |
-
return (f"Error: {e}", "error.png")
|
150 |
finally:
|
151 |
clear_hf_cache_space()
|
152 |
print("Folder cleaned up successfully!")
|
|
|
103 |
|
104 |
def process_model(model_id, q_method, oauth_token: gr.OAuthToken | None):
|
105 |
if oauth_token is None or oauth_token.token is None:
|
106 |
+
raise gr.Error("You must be logged in to use MLX-my-repo")
|
107 |
|
108 |
token = oauth_token.token
|
109 |
# Verify the token
|
|
|
113 |
username = user_info["name"]
|
114 |
print(f"✅ Logged in as {username}")
|
115 |
except Exception as e:
|
116 |
+
raise gr.Error(f"❌ Authentication failed: {e}")
|
117 |
|
118 |
try:
|
119 |
model_name = model_id.split('/')[-1]
|
|
|
145 |
"llama.png",
|
146 |
)
|
147 |
except Exception as e:
|
148 |
+
raise gr.Error(f"❌ Error: {e}")
|
|
|
149 |
finally:
|
150 |
clear_hf_cache_space()
|
151 |
print("Folder cleaned up successfully!")
|