mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: add Phase 4 AI tools with Python bridge and 6 new tools
Add Python bridge (packages/ai/src/bridge.ts) that calls Python scripts via child_process with venv-first fallback to system python3. Implements 6 AI-powered tools: - Remove Background: rembg-based with U2-Net/IS-Net models - Image Upscaling: Real-ESRGAN with Lanczos fallback - OCR/Text Extraction: Tesseract + PaddleOCR engines - Face/PII Blur: MediaPipe face detection with configurable blur - Object Eraser: LaMa inpainting with mask-based input - Smart Crop: Sharp attention-based entropy cropping (no Python needed) Each tool includes: Python script, TypeScript wrapper, API route, and React settings component. All Python scripts handle ImportError gracefully with clear installation messages.
This commit is contained in:
@@ -32,6 +32,13 @@ import { registerFavicon } from "./favicon.js";
|
||||
import { registerImageToPdf } from "./image-to-pdf.js";
|
||||
// Phase 3: Adjustments extra
|
||||
import { registerReplaceColor } from "./replace-color.js";
|
||||
// Phase 4: AI Tools
|
||||
import { registerRemoveBackground } from "./remove-background.js";
|
||||
import { registerUpscale } from "./upscale.js";
|
||||
import { registerOcr } from "./ocr.js";
|
||||
import { registerBlurFaces } from "./blur-faces.js";
|
||||
import { registerEraseObject } from "./erase-object.js";
|
||||
import { registerSmartCrop } from "./smart-crop.js";
|
||||
|
||||
/**
|
||||
* Registry that imports and registers all tool routes.
|
||||
@@ -79,5 +86,13 @@ export async function registerToolRoutes(app: FastifyInstance): Promise<void> {
|
||||
// Phase 3: Adjustments extra
|
||||
registerReplaceColor(app);
|
||||
|
||||
app.log.info("Tool routes registered (26 tools, 29 endpoints)");
|
||||
// Phase 4: AI Tools
|
||||
registerRemoveBackground(app);
|
||||
registerUpscale(app);
|
||||
registerOcr(app);
|
||||
registerBlurFaces(app);
|
||||
registerEraseObject(app);
|
||||
registerSmartCrop(app);
|
||||
|
||||
app.log.info("Tool routes registered (32 tools, 35 endpoints)");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user