Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -6,23 +6,26 @@ subprocess.run(["git", "clone", "https://github.com/huggingface/diffusers.git",
|
|
6 |
|
7 |
def convert(token: str, model_id: str) -> str:
|
8 |
|
9 |
-
if token == "" or model_id == "":
|
10 |
-
return """
|
11 |
-
### Invalid input 🐞
|
12 |
-
Please fill a token and model name.
|
13 |
-
"""
|
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}"
|
28 |
|
|
|
6 |
|
7 |
def convert(token: str, model_id: str) -> str:
|
8 |
|
9 |
+
# if token == "" or model_id == "":
|
10 |
+
# return """
|
11 |
+
# ### Invalid input 🐞
|
12 |
+
# Please fill a token and model name.
|
13 |
+
# """
|
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 |
+
api = HfApi()
|
26 |
+
cpkt_path = hf_hub_download(repo_id="nitrosocke/Arcane-Diffusion", filename="arcane-diffusion-5k.ckpt")
|
27 |
+
return cpkt_path
|
28 |
+
|
29 |
except Exception as e:
|
30 |
return f"#### Error: {e}"
|
31 |
|