Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,14 @@ def convert(token: str, model_id: str) -> str:
|
|
14 |
try:
|
15 |
api = HfApi(token=token)
|
16 |
info = api.model_info(repo_id=model_id)
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
except Exception as e:
|
20 |
return f"#### Error: {e}"
|
|
|
14 |
try:
|
15 |
api = HfApi(token=token)
|
16 |
info = api.model_info(repo_id=model_id)
|
17 |
+
|
18 |
+
# loop info siblings (type is RepoFile) and find the ones which rfilename ends with .ckpt, then return them
|
19 |
+
ckpt_files = [sibling for sibling in info.siblings if sibling.rfilename.endswith(".ckpt")]
|
20 |
+
if len(ckpt_files) == 0:
|
21 |
+
return f"#### Error: No checkpoint file found in the model repo."
|
22 |
+
|
23 |
+
# return file names:
|
24 |
+
return "\n".join([f"- {ckpt_file.rfilename}" for ckpt_file in ckpt_files])
|
25 |
|
26 |
except Exception as e:
|
27 |
return f"#### Error: {e}"
|