Spaces:
Paused
Paused
ekhatskevich
commited on
Commit
·
a7bee92
1
Parent(s):
c97fcf1
fix: tensors
Browse files
app.py
CHANGED
@@ -5,21 +5,23 @@ from huggingface_hub import hf_hub_download
|
|
5 |
|
6 |
def resolve_hf_path(path):
|
7 |
if isinstance(path, str) and path.startswith("hf://"):
|
8 |
-
# The expected format is: hf://{repo_id}@{filename}
|
9 |
parts = path[len("hf://"):].split("@")
|
10 |
-
if len(parts)
|
|
|
|
|
|
|
|
|
|
|
11 |
raise ValueError(f"Invalid HF URI format: {path}")
|
12 |
token = os.environ.get("HUGGINGFACE_HUB_TOKEN")
|
13 |
-
repo_id = parts[0]
|
14 |
-
filename = parts[1]
|
15 |
-
print(f"Downloading {filename} from {repo_id} ...")
|
16 |
if token is None:
|
17 |
raise ValueError("HUGGINGFACE_HUB_TOKEN environment variable not set!")
|
18 |
-
|
|
|
19 |
return local_path
|
20 |
return path
|
21 |
|
22 |
-
os.environ["FLUX_FILL_PATH"] = "hf://black-forest-labs/FLUX.1-Fill-dev
|
23 |
os.environ["PORTRAIT_MODEL_PATH"] = "ms://iic/ACE_Plus@portrait/comfyui_portrait_lora64.safetensors"
|
24 |
os.environ["SUBJECT_MODEL_PATH"] = "ms://iic/ACE_Plus@subject/comfyui_subject_lora16.safetensors"
|
25 |
os.environ["LOCAL_MODEL_PATH"] = "ms://iic/ACE_Plus@local_editing/comfyui_local_lora16.safetensors"
|
|
|
5 |
|
6 |
def resolve_hf_path(path):
|
7 |
if isinstance(path, str) and path.startswith("hf://"):
|
|
|
8 |
parts = path[len("hf://"):].split("@")
|
9 |
+
if len(parts) == 1:
|
10 |
+
repo_id = parts[0]
|
11 |
+
filename = None
|
12 |
+
elif len(parts) == 2:
|
13 |
+
repo_id, filename = parts
|
14 |
+
else:
|
15 |
raise ValueError(f"Invalid HF URI format: {path}")
|
16 |
token = os.environ.get("HUGGINGFACE_HUB_TOKEN")
|
|
|
|
|
|
|
17 |
if token is None:
|
18 |
raise ValueError("HUGGINGFACE_HUB_TOKEN environment variable not set!")
|
19 |
+
# If filename is provided, download that file; otherwise, download the whole repo snapshot.
|
20 |
+
local_path = hf_hub_download(repo_id=repo_id, filename=filename, token=token) if filename else hf_hub_download(repo_id=repo_id, token=token)
|
21 |
return local_path
|
22 |
return path
|
23 |
|
24 |
+
os.environ["FLUX_FILL_PATH"] = "hf://black-forest-labs/FLUX.1-Fill-dev"
|
25 |
os.environ["PORTRAIT_MODEL_PATH"] = "ms://iic/ACE_Plus@portrait/comfyui_portrait_lora64.safetensors"
|
26 |
os.environ["SUBJECT_MODEL_PATH"] = "ms://iic/ACE_Plus@subject/comfyui_subject_lora16.safetensors"
|
27 |
os.environ["LOCAL_MODEL_PATH"] = "ms://iic/ACE_Plus@local_editing/comfyui_local_lora16.safetensors"
|