Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ def run(token: str, model_id: str) -> str:
|
|
32 |
is_private = api.model_info(repo_id=model_id).private
|
33 |
print("is_private", is_private)
|
34 |
|
35 |
-
commit_info = convert(api=api, model_id=model_id)
|
36 |
print("[commit_info]", commit_info)
|
37 |
|
38 |
# save in a (public) dataset:
|
@@ -54,13 +54,17 @@ def run(token: str, model_id: str) -> str:
|
|
54 |
commit_url = repo.push_to_hub()
|
55 |
print("[dataset]", commit_url)
|
56 |
|
57 |
-
|
58 |
### Success 🔥
|
59 |
|
60 |
Yay! This model was successfully converted and a PR was open using your token, here:
|
61 |
|
62 |
[{commit_info.pr_url}]({commit_info.pr_url})
|
63 |
"""
|
|
|
|
|
|
|
|
|
64 |
except Exception as e:
|
65 |
return f"""
|
66 |
### Error 😢😢😢
|
|
|
32 |
is_private = api.model_info(repo_id=model_id).private
|
33 |
print("is_private", is_private)
|
34 |
|
35 |
+
commit_info, errors = convert(api=api, model_id=model_id)
|
36 |
print("[commit_info]", commit_info)
|
37 |
|
38 |
# save in a (public) dataset:
|
|
|
54 |
commit_url = repo.push_to_hub()
|
55 |
print("[dataset]", commit_url)
|
56 |
|
57 |
+
string = f"""
|
58 |
### Success 🔥
|
59 |
|
60 |
Yay! This model was successfully converted and a PR was open using your token, here:
|
61 |
|
62 |
[{commit_info.pr_url}]({commit_info.pr_url})
|
63 |
"""
|
64 |
+
if errors:
|
65 |
+
string += "\nErrors during conversion:\n"
|
66 |
+
string += "\n".join(f"Error while converting {filename}: {e}, skipped conversion" for filename, e in errors)
|
67 |
+
return string
|
68 |
except Exception as e:
|
69 |
return f"""
|
70 |
### Error 😢😢😢
|