Refresh dependencies and compatibility guards

This commit is contained in:
Victor Kuznetsov
2026-07-31 17:24:05 -07:00
parent be7553b55f
commit 9c71dc9c79
7 changed files with 883 additions and 837 deletions
@@ -156,7 +156,6 @@ class TextMarkLocation:
y: int
w: int
h: int
is_fallback: bool = True # geometry anchor (no template match) -> always True for now
@property
def bbox(self) -> tuple[int, int, int, int]:
@@ -512,7 +511,7 @@ class TextMarkEngine:
y = min(margin_b, max(0, h - wm_h)) if c.corner == "tl" else max(0, h - margin_b - wm_h)
wm_w = min(wm_w, w - x)
wm_h = min(wm_h, h - y)
return TextMarkLocation(x=x, y=y, w=wm_w, h=wm_h, is_fallback=True)
return TextMarkLocation(x=x, y=y, w=wm_w, h=wm_h)
# ── Mask ────────────────────────────────────────────────────────────
+3 -2
View File
@@ -22,6 +22,7 @@ import click
from remove_ai_watermarks import __version__, image_io, watermark_registry
from remove_ai_watermarks._internal.constants import SUPPORTED_FORMATS
from remove_ai_watermarks._internal.utils import is_supported_format
from remove_ai_watermarks._internal.watermark_profiles import (
resolve_seed,
resolve_steps,
@@ -143,7 +144,7 @@ def _validate_image(path: Path) -> Path:
if not path.exists():
console.print(f"Error: File not found: {path}")
raise SystemExit(1)
if path.suffix.lower() not in SUPPORTED_FORMATS:
if not is_supported_format(path):
console.print(f"Warning: {path.suffix} may not be supported (expected: {', '.join(SUPPORTED_FORMATS)})")
return path
@@ -2092,7 +2093,7 @@ def cmd_batch(
output_dir = directory.parent / (directory.name + "_clean")
output_dir.mkdir(parents=True, exist_ok=True)
images = sorted(p for p in directory.iterdir() if p.suffix.lower() in SUPPORTED_FORMATS)
images = sorted(p for p in directory.iterdir() if is_supported_format(p))
if not images:
console.print(f"No supported images found in {directory}")
+3 -2
View File
@@ -13,7 +13,6 @@ from __future__ import annotations
import logging
import math
from dataclasses import dataclass
from importlib.util import find_spec
from typing import TYPE_CHECKING, Any
import cv2
@@ -75,7 +74,9 @@ class VideoVaeRuntime:
def is_available() -> bool:
"""Return whether the optional VAE runtime can be imported."""
return find_spec("torch") is not None and find_spec("diffusers") is not None
from remove_ai_watermarks.optional_deps import module_available
return module_available("torch", "diffusers")
def _fit_size(width: int, height: int, long_side: int) -> tuple[int, int]: