feat: Implement Flask-based web interface for Deep-Live-Cam

This commit introduces a significant architectural change, transforming the
Deep-Live-Cam application from a desktop-focused customtkinter application
to a web-based interface powered by Flask.

Key changes and features implemented:

1.  **Web Framework & UI Basics:**
    *   Integrated Flask (`webapp.py`) as the backend framework.
    *   Added basic HTML (`templates/index.html`), CSS (`static/style.css`),
        and JavaScript (`static/main.js`) for the frontend structure.

2.  **Core Logic Refactoring:**
    *   `modules/core.py` was refactored to decouple it from UI-specific
        code, allowing its functions to be used as a library by both the
        new web backend and the existing CLI (`run.py`).
    *   Utility functions in `modules/utilities.py` were updated for
        better modularity and explicit path handling.

3.  **Web UI Functionality:**
    *   **File Uploads:** Implemented API endpoints and frontend JavaScript
        to allow you to upload source face images and target media
        (images/videos). Previews are shown for selected files.
    *   **Settings Management:** You can toggle processing options (e.g.,
        keep FPS, mouth mask) in the web UI, and these settings are sent
        to the backend to update global configurations.
    *   **File Processing:** A `/start_processing` API endpoint triggers the
        core face swapping logic on uploaded files. Processed files can be
        downloaded via a separate endpoint. (Current processing is synchronous).
    *   **Live Webcam Preview:**
        *   A `/video_feed` endpoint streams live camera input to the browser.
        *   This feed now incorporates real-time face swapping and other
            selected processing effects (e.g., FPS counter, enhancers if toggled),
            using the uploaded source face and current settings.
    *   **Face Mapping via Web UI:**
        *   Implemented functionality for you to define specific source faces
            for multiple target faces detected in an uploaded image.
        *   Backend APIs were created to analyze target images, send detected
            face data (as base64 images) to the frontend, and then receive
            your submitted mappings (source images per target face).
        *   The `face_swapper.py` module was enhanced with `v2` processing
            methods (`process_image_v2`, `process_video_v2`, updated
            `process_frame_v2`) that utilize these detailed mappings.
        *   Both file-based processing and the live webcam feed now respect
            these mappings if the "Map Faces" option is enabled.

This lays the groundwork for a fully featured web version of Deep-Live-Cam.
Further work will focus on UX refinements (like async processing, better
error handling, UI for clearing mappings) and comprehensive testing.
pull/1375/head
google-labs-jules[bot] 2025-06-20 16:47:34 +00:00
parent 6210b067cc
commit b7f92acb34

Diff Content Not Available