mirror of
https://github.com/wiltodelta/remove-ai-watermarks.git
synced 2026-10-14 13:30:55 +02:00
- Lock OpenCV 5 and cap NumPy below 2.4 through uv constraint-dependencies so PaddleX 3.7 keeps resolving; Dependabot ignores mirror the cap. - OpenCV 5 draws Hershey putText glyphs differently, so the Dola and Kling video templates ship as committed OpenCV 4 renders with a recipe script, and the OpenArt alpha recipe now refuses any OpenCV but 4.x. - Break Sora/Veo cross-matches in favor of Veo under valid Google AI-video provenance, and require the full Sora mascot shape for mascot-only matches. - Let the Doubao engine detect marks tinted by saturated backgrounds. - Share C2PA claim-generator, credential-level and vendor-platform helpers, JPEG suffixes and the DCT basis instead of per-module copies. - Log model download failures, document the optional GITHUB_TOKEN, mark the photo and source classifier model cards archived, and refresh the lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
2.3 KiB
Python
61 lines
2.3 KiB
Python
"""Path resolution for Hub photo-classify publish, no network."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
SCRIPTS = Path(__file__).resolve().parents[1] / "scripts"
|
|
sys.path.insert(0, str(SCRIPTS))
|
|
import publish_photo_classify_hf as publish # noqa: E402
|
|
|
|
|
|
def test_hub_ids_match_the_runtime_loader() -> None:
|
|
# The workflow runs this script with --no-project, so it cannot import the package constants.
|
|
from remove_ai_watermarks.classify import RECEIPT_GATE_FILE, RECEIPT_GATE_STABLE_FILE, WEIGHTS_REPO
|
|
|
|
assert publish.HUB_REPO == WEIGHTS_REPO
|
|
assert publish.GATE_FILE == RECEIPT_GATE_FILE
|
|
assert publish.GATE_STABLE_FILE == RECEIPT_GATE_STABLE_FILE
|
|
assert publish.GATE_SOURCE.is_file()
|
|
|
|
|
|
def test_publish_freeze_includes_both_clip_runtimes() -> None:
|
|
from remove_ai_watermarks.classify import _WEIGHT_FILES, CLIP_ONNX_FILE, WEIGHTS_ALLOW_PATTERNS
|
|
|
|
assert publish.CLIP_FILE in publish.WEIGHT_FILES
|
|
assert publish.CLIP_ONNX_FILE in publish.WEIGHT_FILES
|
|
assert set(publish.WEIGHT_FILES) == {*_WEIGHT_FILES, CLIP_ONNX_FILE}
|
|
assert set(publish.WEIGHT_FILES) <= set(WEIGHTS_ALLOW_PATTERNS)
|
|
|
|
|
|
def test_weight_paths_accepts_run1_layout(tmp_path: Path) -> None:
|
|
(tmp_path / "clip-l-ft.pt").write_bytes(b"clip")
|
|
(tmp_path / "clip-l-ft-vision-fp32.onnx").write_bytes(b"onnx")
|
|
(tmp_path / "probe-weights-clip-l-ft.npz").write_bytes(b"probe")
|
|
run1 = tmp_path / "run1"
|
|
run1.mkdir()
|
|
(run1 / "detector.pt").write_bytes(b"det")
|
|
(run1 / "provider.pt").write_bytes(b"prov")
|
|
found = publish.weight_paths(tmp_path)
|
|
assert found["detector.pt"] == run1 / "detector.pt"
|
|
assert found["clip-l-ft.pt"] == tmp_path / "clip-l-ft.pt"
|
|
|
|
|
|
def test_weight_paths_requires_every_file(tmp_path: Path) -> None:
|
|
(tmp_path / "clip-l-ft.pt").write_bytes(b"clip")
|
|
(tmp_path / "clip-l-ft-vision-fp32.onnx").write_bytes(b"onnx")
|
|
with pytest.raises(SystemExit, match=r"missing probe-weights-clip-l-ft\.npz"):
|
|
publish.weight_paths(tmp_path)
|
|
|
|
|
|
def test_stage_card_copies_tracked_files(tmp_path: Path) -> None:
|
|
dest = tmp_path / "stage"
|
|
publish.stage_card(dest)
|
|
assert (dest / "README.md").is_file()
|
|
assert (dest / "operating-point.json").is_file()
|
|
text = (dest / "operating-point.json").read_text()
|
|
assert "clip-l-ft.pt" in text
|