Skip to content

RishiBuilds/SnapErase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SnapErase 📸

Release Python Flask Docker License

SnapErase (v1.2.0) is a professional-grade, AI-powered background removal tool. It combines the power of deep learning with a streamlined, secure web interface to provide instant, high-quality image processing.

FeaturesTech StackInstallationAPI DocumentationSecurity


Features

  • Precision Background Removal: Leverages the u2net model (via rembg) for complex edge detection.
  • Interactive UI:
    • Before/After Demo: Real-time comparison slider to see the AI magic in action.
    • Adaptive Navbar: Smooth glassmorphism transition on scroll for a premium feel.
  • Modern Design: Sleek, AI-native interface featuring Outfit typography and glassmorphism panels.
  • Enterprise-Grade Security: Hardened with CSRF protection, rate limiting, and strict CSP headers.
  • High Performance:
    • In-Memory Buffer: Processing happens in RAM to minimize disk I/O.
    • Smart Caching: Hash-based deduplication to serve repeat images instantly.
  • Cloud Native: Optimized multistage Docker build with automated healthchecks and non-root security.

Tech Stack

  • Backend: Python 3.10+, Flask
  • AI Core: rembg (U2-Net), PIL (Pillow)
  • Frontend: Modern Vanilla CSS (Flexbox/Grid), Vanilla JavaScript (ES6+), Lucide Icons
  • Security: Flask-WTF (CSRF), Flask-Limiter (Rate Limiting)
  • Infrastructure: Gunicorn, Docker (Multistage), Healthcheck APIs

Installation

Local Setup

  1. Clone the repository:

    git clone https://github.com/RishiBuilds/SnapErase.git
    cd SnapErase
  2. Environment Configuration:

    python -m venv venv
    source venv/bin/activate  # Windows: venv\Scripts\activate
    pip install -r requirements.txt
  3. Configure Environment Variables: Create a .env file from the provided template:

    SECRET_KEY=your_secure_random_key
    FLASK_DEBUG=False
    MAX_CONTENT_LENGTH=16777216
  4. Launch Application:

    python app.py

    Access the dashboard at http://localhost:5000.

Docker Deployment

SnapErase uses a multistage build for a lean production image:

docker build -t snaperase:latest .
docker run -d -p 5000:5000 --name snaperase_app snaperase:latest

The container includes a built-in healthcheck that monitors the service status every 30 seconds.

API Documentation

Background Removal Endpoint

POST /remove-bg

Parameter Type Required Description
image File Yes The image file (PNG, JPG, JPEG, WEBP)
format String No image (direct download) or json (Base64)

Sample JSON Response:

{
  "success": true,
  "image": "data:image/png;base64,iVBORw0KGgoAAAANSUh..."
}

Security Monitoring

SnapErase implements several layers of protection:

  • Rate Limiting: Prevents API abuse (default: 200/day, 50/hour).
  • MIME Validation: Strict checking of magic bytes to prevent polyglot file attacks.
  • Non-Root Execution: Docker container runs as a non-privileged appuser.
  • Header Hardening: CSP, X-Content-Type-Options, X-Frame-Options, and X-XSS-Protection.

Developed with passion by Rishi Builds

Released under the MIT License

About

background removal web app built with Flask and rembg. Upload an image, remove its background instantly, and download a clean transparent PNG.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors