mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: production Docker, Playwright tests, settings API, and bug fixes
- Add user management endpoints (register, list, delete, change password) - Add API key management (create, list, delete) - Add settings persistence endpoints (get, put) - Wire settings dialog to real backend (People, API Keys, System, Security) - Fix login auth flow (window.location.href for full reload) - Fix download URLs returning 401 (make public since UUIDs are unguessable) - Fix border tool shadowColor validation (accept 6-8 hex digits) - Fix remove-bg alpha matting fallback (retry without on failure) - Fix AI tool silent fallbacks (report errors instead of no-ops) - Add checkerboard background to before/after slider for transparency - Add progress bars to all AI tool components - Add Playwright E2E test suite (131 tests across 9 test files) - Rewrite Dockerfile for production (tsx runtime, pre-baked AI models) - Add .dockerignore for faster builds - Add proper accessible labels to login form
This commit is contained in:
@@ -63,18 +63,16 @@ def main():
|
||||
)
|
||||
|
||||
except ImportError:
|
||||
# Fallback: no face detection available, save original
|
||||
img.save(output_path)
|
||||
# MediaPipe not available — report error clearly
|
||||
print(
|
||||
json.dumps(
|
||||
{
|
||||
"success": True,
|
||||
"facesDetected": 0,
|
||||
"faces": [],
|
||||
"note": "mediapipe not available - no faces detected",
|
||||
"success": False,
|
||||
"error": "Face detection requires the mediapipe package. Install with: pip install mediapipe",
|
||||
}
|
||||
)
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
except ImportError:
|
||||
print(
|
||||
|
||||
@@ -41,12 +41,21 @@ def main():
|
||||
Image.fromarray(result).save(output_path)
|
||||
method = "lama"
|
||||
|
||||
except (ImportError, Exception):
|
||||
# Fallback: simple inpainting using PIL
|
||||
# Just copy the image (mask areas won't be processed without ML model)
|
||||
img = Image.open(input_path)
|
||||
img.save(output_path)
|
||||
method = "copy"
|
||||
except ImportError:
|
||||
# LaMa not available — report error instead of silently copying
|
||||
print(
|
||||
json.dumps(
|
||||
{
|
||||
"success": False,
|
||||
"error": "Object eraser requires the lama-cleaner package. Install with: pip install lama-cleaner",
|
||||
}
|
||||
)
|
||||
)
|
||||
sys.exit(1)
|
||||
except Exception as e:
|
||||
# LaMa installed but processing failed — still report error
|
||||
print(json.dumps({"success": False, "error": f"Inpainting failed: {str(e)}"}))
|
||||
sys.exit(1)
|
||||
|
||||
print(json.dumps({"success": True, "method": method}))
|
||||
|
||||
|
||||
@@ -16,12 +16,17 @@ def main():
|
||||
with open(input_path, "rb") as f:
|
||||
input_data = f.read()
|
||||
|
||||
output_data = remove(
|
||||
input_data,
|
||||
alpha_matting=True,
|
||||
alpha_matting_foreground_threshold=240,
|
||||
alpha_matting_background_threshold=10,
|
||||
)
|
||||
# Try with alpha matting first for better edges, but fall back
|
||||
# without it if the image triggers the known rembg matting error
|
||||
try:
|
||||
output_data = remove(
|
||||
input_data,
|
||||
alpha_matting=True,
|
||||
alpha_matting_foreground_threshold=240,
|
||||
alpha_matting_background_threshold=10,
|
||||
)
|
||||
except Exception:
|
||||
output_data = remove(input_data)
|
||||
|
||||
with open(output_path, "wb") as f:
|
||||
f.write(output_data)
|
||||
|
||||
Reference in New Issue
Block a user