mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: QA sweep — 7 bugs fixed, 17 test corrections
Code fixes: - Sidebar state bleed: reset file store on HomePage mount - restore-photo: raise error instead of silently skipping colorize when DDColor model missing - PaddleOCR OOM: cap input images to 2048px before OCR inference - Torch CPU optimization: use --index-url .../whl/cpu on CPU nodes Test fixes: - upscale: add exact:true to scale factor button locators - smart-crop: add exact:true to "Pad to square" locator - colorize: use regex for model button names (Best/Balanced/Fast) - enhance-faces: use .first() for ambiguous percentage display - passport-photo: fix DPI locator, .or() compound, generate fallback - people: update maxUsers assertions for unlimited (0) default - automate: "Save Pipeline" → "Save" matching actual button text - tools.test: add resize to Sharp mock chain for OCR tests
This commit is contained in:
@@ -75,7 +75,7 @@ def cpu_fallback_packages(packages: list[str]) -> list[str]:
|
||||
# "torch==2.7.0+cu126 torchvision==0.22.0+cu126 --index-url ..."
|
||||
first_token = pkg.split()[0] if pkg.strip() else ""
|
||||
if first_token.startswith("torch==") and "+cu" in first_token:
|
||||
# Extract torch and torchvision versions, strip CUDA suffix
|
||||
# Extract torch and torchvision versions, use CPU-only index
|
||||
cpu_pkgs = []
|
||||
for token in pkg.split():
|
||||
if token.startswith("torch==") and "+cu" in token:
|
||||
@@ -84,7 +84,9 @@ def cpu_fallback_packages(packages: list[str]) -> list[str]:
|
||||
elif token.startswith("torchvision==") and "+cu" in token:
|
||||
base_ver = token.split("+")[0] # "torchvision==0.21.0"
|
||||
cpu_pkgs.append(base_ver)
|
||||
# Drop --index-url and its argument (not needed for CPU torch)
|
||||
# Use CPU-only wheels (~200MB vs ~2.6GB with CUDA)
|
||||
cpu_pkgs.append("--index-url")
|
||||
cpu_pkgs.append("https://download.pytorch.org/whl/cpu")
|
||||
result.extend(cpu_pkgs)
|
||||
continue
|
||||
|
||||
|
||||
@@ -483,7 +483,10 @@ def colorize_bw(img_bgr, intensity=0.85):
|
||||
from gpu import safe_onnx_session
|
||||
|
||||
if not os.path.exists(DDCOLOR_MODEL_PATH):
|
||||
return img_bgr, False
|
||||
raise FileNotFoundError(
|
||||
f"DDColor model not found at {DDCOLOR_MODEL_PATH}. "
|
||||
"Install the 'object-eraser-colorize' bundle to enable colorization."
|
||||
)
|
||||
|
||||
session, _device = safe_onnx_session(DDCOLOR_MODEL_PATH)
|
||||
input_name = session.get_inputs()[0].name
|
||||
|
||||
Reference in New Issue
Block a user