Spaces:
Running on Zero
Running on Zero
| from __future__ import annotations | |
| import hashlib | |
| from pathlib import Path | |
| import sys | |
| RIFE_COMMIT = "26545cc2dd95bc3d27f056016300673bdeee78f5" | |
| EXPECTED_HASHES = { | |
| # These two files include the local keep_output_on_device extension. The | |
| # hashes pin that reviewed variant, not an unmodified upstream checkout. | |
| "vfi_utils.py": "73e3d0268590e0932db8eef97d011b9d47b9291cd7d7c241021aa77f143d1318", | |
| "vfi_models/rife/__init__.py": "ee793b3414d9bfe0dc58aaf9ffae127dc55e281559ba26dd69f33e710eda20e2", | |
| "vfi_models/rife/rife_arch.py": "1cb6a4ef8f38b12cbfc260df4f8656a92e5c89f0e764b8f2339beb411147311c", | |
| "config.yaml": "7eb60f495228022f545d35ef7b1146e246757987279d782438d1c4ff25e06b5d", | |
| } | |
| def prepare_rife_source() -> Path: | |
| comfy_runtime = Path(__file__).resolve().parent / "third_party" / "comfy_runtime" | |
| root = Path(__file__).resolve().parent / "third_party" / "rife" | |
| for relative, expected in EXPECTED_HASHES.items(): | |
| path = root / relative | |
| if not path.is_file(): | |
| raise FileNotFoundError(f"Sorgente RIFE vendorizzato mancante: {path}") | |
| actual = hashlib.sha256(path.read_bytes()).hexdigest() | |
| if actual != expected: | |
| raise RuntimeError(f"Hash sorgente RIFE inatteso: {relative}") | |
| for path in (comfy_runtime, root): | |
| if str(path) not in sys.path: | |
| sys.path.insert(0, str(path)) | |
| return root | |