diff --git a/nodes/load_model.py b/nodes/load_model.py index b0d6425..47930c2 100644 --- a/nodes/load_model.py +++ b/nodes/load_model.py @@ -15,6 +15,31 @@ from comfy_api.latest import io log = logging.getLogger("sharp") + +def _comfy_tqdm(): + """tqdm that shows download progress in ComfyUI's UI.""" + try: + import comfy.utils + import tqdm as _tqdm_mod + except ImportError: + return None + holder = {"pbar": None, "total": 0, "done": 0} + class _T(_tqdm_mod.tqdm): + def __init__(self, *a, **kw): + super().__init__(*a, **kw) + if self.total and self.total > 0 and holder["pbar"] is None: + holder["total"] = self.total + holder["done"] = 0 + holder["pbar"] = comfy.utils.ProgressBar(self.total) + def update(self, n=1): + ret = super().update(n) + if n and holder["pbar"] and holder["total"] > 0: + holder["done"] = min(holder["done"] + n, holder["total"]) + holder["pbar"].update_absolute(holder["done"], holder["total"]) + return ret + return _T + + # Try to get ComfyUI models directory try: import folder_paths @@ -165,6 +190,7 @@ class LoadSharpModel(io.ComfyNode): repo_id=SHARP_REPO_ID, filename=SHARP_FILENAME, local_dir=MODELS_DIR, + tqdm_class=_comfy_tqdm(), ) log.info(f"SHARP config: precision={precision} -> dtype={dtype_str}, path={model_path}") diff --git a/pyproject.toml b/pyproject.toml index ba0357e..a49bb5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui-sharp" description = "ComfyUI wrapper around Apple's latest SHARP model (ml-sharp). Monocular 3D Gaussian Splatting in under 1 second. Generate 3D Gaussians from a single image using Apple's SHARP model." -version = "0.1.7" +version = "0.1.8" license = {file = "LICENSE"} diff --git a/requirements.txt b/requirements.txt index f4cefea..bd164be 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ -comfy-env==0.3.75 +comfy-env==0.3.78 comfy-3d-viewers==0.2.44 \ No newline at end of file