Update app.py
Browse files
app.py
CHANGED
@@ -9,6 +9,7 @@ api = HfApi()
|
|
9 |
REPO_TYPES = ["model", "dataset", "space"]
|
10 |
|
11 |
def upload_model(source_url, dst_repo, token,civitai_api_key, new_name, dst_repo_path, repo_type):
|
|
|
12 |
_ = whoami(token) # Check token validity
|
13 |
|
14 |
# Check if destination path ends with '/'
|
@@ -68,7 +69,8 @@ def upload_model(source_url, dst_repo, token,civitai_api_key, new_name, dst_repo
|
|
68 |
f'Your model has been successfully uploaded to <a href="{repo_url}" target="_blank" style="text-decoration:underline">your Hugging Face repository</a>.',
|
69 |
"success.jpg",
|
70 |
)
|
71 |
-
|
|
|
72 |
|
73 |
# Interface setup
|
74 |
interface = gr.Interface(
|
|
|
9 |
REPO_TYPES = ["model", "dataset", "space"]
|
10 |
|
11 |
def upload_model(source_url, dst_repo, token,civitai_api_key, new_name, dst_repo_path, repo_type):
|
12 |
+
try:
|
13 |
_ = whoami(token) # Check token validity
|
14 |
|
15 |
# Check if destination path ends with '/'
|
|
|
69 |
f'Your model has been successfully uploaded to <a href="{repo_url}" target="_blank" style="text-decoration:underline">your Hugging Face repository</a>.',
|
70 |
"success.jpg",
|
71 |
)
|
72 |
+
except Exception as e:
|
73 |
+
return str(e), "error.jpg"
|
74 |
|
75 |
# Interface setup
|
76 |
interface = gr.Interface(
|