Skip to content
프로젝트

PRITHIVSAKTHIUR/FireRed-Image-Edit-1.0-Fast

GitHub에서 보기

소개

FireRed-Image-Edit-1.0-Fast is a high-performance, AI-driven image editing application that utilizes advanced diffusers and the QIE+ Pipeline for precise, prompt-based image modifications.

디자인 및 미디어

이 수치를 측정하는 방법

What you can do

  • NCII Safety Guard Integration: Screens input prompts with hfmlsoc/ncii-guard-v02 running in an isolated CPU-only subprocess, and blocks unsafe requests through a /check_safety pre-flight before any GPU resource is queued.
  • Flash Attention 3 (FA3) Acceleration: Hooks natively into the QwenDoubleStreamAttnProcessorFA3 processor layer to accelerate cross-attention inference phases while reducing active GPU memory consumption.
  • Multi-Image Reference Manipulation: Supports uploading multiple reference images to guide edits—such as swapping clothing or accessory items from a reference image onto a target subject while preserving facial identity and background context.
  • Studio SPA Interface: An interactive single-page application built with modern vanilla web components—featuring an A/B image comparison slider, history filmstrip, quick prompt chips, and drag-and-drop file support.

측정된 스타 증가

in 24h
0
in 7 days
기록 수집 중
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

FireRed-Image-Edit-1.0-Fast

FireRed-Image-Edit-1.0-Fast is an experimental, high-performance image editing and style-transfer platform built on top of the FireRedTeam/FireRed-Image-Edit-1.1 pipeline. The application integrates an optimized transformer architecture (prithivMLmods/Qwen-Image-Edit-Rapid-AIO-V19) alongside Flash Attention 3 (QwenDoubleStreamAttnProcessorFA3) to execute complex single- and multi-image edit instructions in a rapid 4-step sampling window.

To ensure responsible usage, the pipeline incorporates an NCII (Non-Consensual Intimate Imagery) safety guard model (hfmlsoc/ncii-guard-v02) that runs in an isolated CPU subprocess. A /check_safety pre-flight screens every prompt before any GPU work is queued, and the GPU worker re-checks it as defense in depth. The application is served via a single-page web app built with a FastAPI backend server (gradio.Server) and a dark red-themed frontend interface featuring a dual-view canvas, A/B comparison slider, history filmstrip, and interactive prompt suggestions.

image (2)

Key Features

  • NCII Safety Guard Integration: Screens input prompts with hfmlsoc/ncii-guard-v02 running in an isolated CPU-only subprocess, and blocks unsafe requests through a /check_safety pre-flight before any GPU resource is queued.
  • Flash Attention 3 (FA3) Acceleration: Hooks natively into the QwenDoubleStreamAttnProcessorFA3 processor layer to accelerate cross-attention inference phases while reducing active GPU memory consumption.
  • Multi-Image Reference Manipulation: Supports uploading multiple reference images to guide edits—such as swapping clothing or accessory items from a reference image onto a target subject while preserving facial identity and background context.
  • Studio SPA Interface: An interactive single-page application built with modern vanilla web components—featuring an A/B image comparison slider, history filmstrip, quick prompt chips, and drag-and-drop file support.
  • Smart Aspect Ratio Snapping: Automatically resizes uploaded images to stay within 1024px while snapping width and height to multiples of 8 to prevent shape mismatch errors during inference.

Repository Structure

├── examples/
│   ├── 1.jpg
│   ├── 10.jpg
│   ├── 11.png
│   ├── 2.jpg
│   ├── 3.jpeg
│   ├── 4.jpg
│   ├── 5.jpg
│   ├── 6.jpg
│   ├── 7.webp
│   ├── 8.jpg
│   └── 9.png
├── qwenimage/
│   ├── __init__.py
│   ├── pipeline_qwenimage_edit_plus.py
│   ├── qwen_fa3_processor.py
│   └── transformer_qwenimage.py
├── app.py
├── index.html
├── LICENSE.txt
├── ncii_guard.py
├── pre-requirements.txt
├── pyproject.toml
├── README.md
├── requirements.txt
└── uv.lock

Installation and Requirements

To set up the FireRed-Image-Edit-1.0-Fast environment locally, configure your system according to the specifications below. A modern CUDA-enabled GPU is required.

  • Python Version: Python 3.14 or newer is required (requires-python = ">=3.14").
  • PyTorch Version: torch==2.11.0 or above is required for best compatibility.
  • CUDA Version: CUDA 13.0 is recommended (--extra-index-url https://download.pytorch.org/whl/cu130), matching the environment used on the live Hugging Face demo.

Running with uv (Recommended)

uv is an ultra-fast Python package and project manager written in Rust. It ensures rapid virtual environment setup and exact dependency synchronization based on the uv.lock file.

Step 1 — Install uv

  • macOS / Linux: curl -LsSf https://astral.sh/uv/install.sh | sh
  • Windows: powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

Step 2 — Clone the repository

git clone https://github.com/PRITHIVSAKTHIUR/FireRed-Image-Edit-1.0-Fast.git
cd FireRed-Image-Edit-1.0-Fast

Step 3 — Initialize the project and install dependencies

uv sync

Step 4 — Run the script

uv run app.py

Standard PIP Implementation

1. Update Package Manager Upgrade your local package manager:

pip install "pip>=26.2.1"

2. Install Core Dependencies Install the primary deep learning stack, transformer libraries, and core computing utilities listed in requirements.txt:

pip install -r requirements.txt

Core Requirements List (requirements.txt)

--extra-index-url https://download.pytorch.org/whl/cu130
torch==2.11.0
torchvision==0.26.0
transformers==5.14.1
accelerate==1.14.0
diffusers==0.39.0
peft==0.19.1
gradio==6.30.0
av==17.1.0
spaces>=0.51.3
huggingface-hub==1.24.0
kernels>=0.16.0

Safety Guard

Prompt safety is enforced in two stages so that unsafe requests never consume GPU time:

  • Isolated CPU classifier: ncii_guard.py hosts the hfmlsoc/ncii-guard-v02 text classifier in a plain subprocess. The child interpreter never imports spaces or touches CUDA, which keeps the GPU worker's initialization state intact. The parent talks to it over stdin/stdout using one JSON object per line.
  • Pre-flight endpoint: /check_safety (queue=False) evaluates the prompt on CPU and returns {"status": "ok"} or {"status": "blocked", "message": ...}. The frontend calls it before /edit_image, so a blocked prompt never enters the GPU queue.
  • Defense-in-depth re-check: edit_image re-runs the same check inside the GPU worker and returns a blocked payload without running inference.
  • Threshold: a prompt is blocked when the classifier label is ncii with a score of at least 0.5.
  • Fail-open: if the guard subprocess is unavailable, requests proceed normally so the Space stays usable.

Usage

Once the web server initializes, open your browser to the local address output in your terminal (typically http://127.0.0.1:7860/).

  1. Upload Asset: Drag and drop an image into the main canvas workspace, paste an image from your clipboard, or click the upload icon in the left rail.
  2. Refine Instructions: Type your instructions inside the prompt field, or click one of the Quick Prompts chips to instantly fill it. Press ⌘/Ctrl + Enter or click Edit Image.
  3. Safety Guard Processing: Before anything is queued, the prompt is screened on CPU by the NCII safety guard. Unsafe prompts are blocked immediately with a warning notification; safe prompts then proceed to the GPU worker, which performs a final re-check.
  4. Compare & Chain: Use the Compare tool on the left rail to view an A/B slider of the before and after states. Click Use as Input to chain multiple edits sequentially.

Links and Source

관련 프로젝트 살펴보기

불러오는 중…