multimodalart HF Staff commited on
Commit
05ad421
·
verified ·
1 Parent(s): b4a27cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -8,6 +8,14 @@ from typing import Sequence, Mapping, Any, Union
8
  from huggingface_hub import hf_hub_download
9
  import spaces
10
 
 
 
 
 
 
 
 
 
11
  # --- Model Downloads ---
12
  print("Downloading models from Hugging Face Hub...")
13
  text_encooder_repo = hf_hub_download_local(repo_id="Comfy-Org/Wan_2.1_ComfyUI_repackaged", filename="split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors", local_dir="models/text_encoders")
@@ -47,14 +55,6 @@ def get_value_at_index(obj: Union[Sequence, Mapping], index: int) -> Any:
47
  except KeyError:
48
  return obj["result"][index]
49
 
50
- def hf_hub_download_local(repo_id, filename, local_dir, **kwargs):
51
- downloaded_path = hf_hub_download(repo_id=repo_id, filename=filename, **kwargs)
52
- os.makedirs(local_dir, exist_ok=True)
53
- base_filename = os.path.basename(filename)
54
- target_path = os.path.join(local_dir, base_filename)
55
- shutil.move(downloaded_path, target_path)
56
- return target_path
57
-
58
 
59
  # --- ZeroGPU: Pre-load models and instantiate nodes globally ---
60
  cliploader = nodes.NODE_CLASS_MAPPINGS["CLIPLoader"]()
 
8
  from huggingface_hub import hf_hub_download
9
  import spaces
10
 
11
+ def hf_hub_download_local(repo_id, filename, local_dir, **kwargs):
12
+ downloaded_path = hf_hub_download(repo_id=repo_id, filename=filename, **kwargs)
13
+ os.makedirs(local_dir, exist_ok=True)
14
+ base_filename = os.path.basename(filename)
15
+ target_path = os.path.join(local_dir, base_filename)
16
+ shutil.move(downloaded_path, target_path)
17
+ return target_path
18
+
19
  # --- Model Downloads ---
20
  print("Downloading models from Hugging Face Hub...")
21
  text_encooder_repo = hf_hub_download_local(repo_id="Comfy-Org/Wan_2.1_ComfyUI_repackaged", filename="split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors", local_dir="models/text_encoders")
 
55
  except KeyError:
56
  return obj["result"][index]
57
 
 
 
 
 
 
 
 
 
58
 
59
  # --- ZeroGPU: Pre-load models and instantiate nodes globally ---
60
  cliploader = nodes.NODE_CLASS_MAPPINGS["CLIPLoader"]()