Spaces:
Sleeping
Sleeping
ekhatskevich
commited on
Commit
·
50bfc5a
1
Parent(s):
b3a0761
fix: paths
Browse files- app.py +20 -3
- requirements.txt +3 -1
app.py
CHANGED
@@ -1,16 +1,33 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
from scepter.modules.utils.file_system import FS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
-
# Set necessary environment variables for ACE++
|
6 |
os.environ["FLUX_FILL_PATH"] = "hf://black-forest-labs/FLUX.1-Fill-dev"
|
7 |
os.environ["PORTRAIT_MODEL_PATH"] = "ms://iic/ACE_Plus@portrait/comfyui_portrait_lora64.safetensors"
|
8 |
os.environ["SUBJECT_MODEL_PATH"] = "ms://iic/ACE_Plus@subject/comfyui_subject_lora16.safetensors"
|
9 |
os.environ["LOCAL_MODEL_PATH"] = "ms://iic/ACE_Plus@local_editing/comfyui_local_lora16.safetensors"
|
10 |
os.environ["ACE_PLUS_FFT_MODEL"] = "hf://ali-vilab/ACE_Plus@ace_plus_fft.safetensors"
|
11 |
|
12 |
-
|
13 |
-
|
|
|
|
|
|
|
|
|
14 |
|
15 |
from inference.ace_plus_inference import ACEInference
|
16 |
from scepter.modules.utils.config import Config
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
from scepter.modules.utils.file_system import FS
|
4 |
+
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) != 2:
|
11 |
+
raise ValueError(f"Invalid HF URI format: {path}")
|
12 |
+
repo_id = parts[0]
|
13 |
+
filename = parts[1]
|
14 |
+
print(f"Downloading {filename} from {repo_id} ...")
|
15 |
+
local_path = hf_hub_download(repo_id=repo_id, filename=filename)
|
16 |
+
return local_path
|
17 |
+
return path
|
18 |
|
|
|
19 |
os.environ["FLUX_FILL_PATH"] = "hf://black-forest-labs/FLUX.1-Fill-dev"
|
20 |
os.environ["PORTRAIT_MODEL_PATH"] = "ms://iic/ACE_Plus@portrait/comfyui_portrait_lora64.safetensors"
|
21 |
os.environ["SUBJECT_MODEL_PATH"] = "ms://iic/ACE_Plus@subject/comfyui_subject_lora16.safetensors"
|
22 |
os.environ["LOCAL_MODEL_PATH"] = "ms://iic/ACE_Plus@local_editing/comfyui_local_lora16.safetensors"
|
23 |
os.environ["ACE_PLUS_FFT_MODEL"] = "hf://ali-vilab/ACE_Plus@ace_plus_fft.safetensors"
|
24 |
|
25 |
+
flux_fill_path = resolve_hf_path(os.environ["FLUX_FILL_PATH"])
|
26 |
+
ace_plus_fft_model_path = resolve_hf_path(os.environ["ACE_PLUS_FFT_MODEL"])
|
27 |
+
|
28 |
+
# Update the environment variables with the resolved local file paths.
|
29 |
+
os.environ["FLUX_FILL_PATH"] = flux_fill_path
|
30 |
+
os.environ["ACE_PLUS_FFT_MODEL"] = ace_plus_fft_model_path
|
31 |
|
32 |
from inference.ace_plus_inference import ACEInference
|
33 |
from scepter.modules.utils.config import Config
|
requirements.txt
CHANGED
@@ -4,4 +4,6 @@ scepter
|
|
4 |
torch
|
5 |
torchvision
|
6 |
transformers
|
7 |
-
lightning
|
|
|
|
|
|
4 |
torch
|
5 |
torchvision
|
6 |
transformers
|
7 |
+
lightning
|
8 |
+
huggingface_hub
|
9 |
+
safetensors
|