Find a file
2026-03-22 15:15:50 -06:00
firered FireRed cache dit config 2026-03-22 13:45:18 -06:00
gradio Add gradio service file 2026-03-22 13:32:49 -06:00
.gitignore git ignores 2026-03-22 13:13:12 -06:00
LICENSE-apache.txt Apache 2.0 2026-03-22 13:12:58 -06:00
README.md Use comfyui... 2026-03-22 15:15:50 -06:00

Image Edit

Editing images with AI.

Just use ComfyUI with FireRed-Image-Edit 1.1.

Ignore below....

XXX

Right now, using gradio with FireRed-Image-Edit-1.1 served up by sglang.

Web Interface

There are many options for image editing. Quick, dirty, and easy is gradio.

Install

Thusly:

git clone https://spacecruft.org/deepcrayon/image-edit
cd image-edit/gradio
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install -r requirements.txt
deactivate
sudo cp gradio.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl start gradio.service
sudo systemctl status gradio.service
sudo systemctl enable gradio.service

Inference

There are a lot of edit models too. Right now FireRed-Image-Edit-1.1 is one of the best.

Install

# git clone https://spacecruft.org/deepcrayon/image-edit
# cd image-edit/firered
cd ../firered
# For B200 GPU
export TORCH_CUDA_ARCH_LIST="10.0"
python -m venv venv
source venv/bin/activate
pip install -U setuptools pip wheel
pip install "sglang[all] @ git+https://github.com/sgl-project/sglang.git@64950d8f9735e0e0f652092b695d21e3ca34f310#subdirectory=python"
pip install accelerate
pip install --no-build-isolation flash-attn
pip install nvidia-cudnn-cu12==9.16.0.29

# update registry for FireRed model:
sed -i 's|hf_model_paths=\["Qwen/Qwen-Image-Edit-2509"\]|hf_model_paths=["Qwen/Qwen-Image-Edit-2509", "FireRedTeam/FireRed-Image-Edit-1.1"]|' ./venv/lib/python3.13/site-packages/sglang/multimodal_gen/registry.py

# Patch a bug with HEAD
sed -i '/^                setattr(encoder_config\.arch_config, key, value)$/a\            for _prop in ("image_token_id", "video_token_id", "vision_start_token_id", "vision_end_token_id", "vision_token_id"):\
                if hasattr(diffusers_pretrained_config, _prop):\
                    setattr(encoder_config.arch_config, _prop, getattr(diffusers_pretrained_config, _prop))' \
  ./venv/lib/python3.13/site-packages/sglang/multimodal_gen/runtime/loader/component_loaders/text_encoder_loader.py

sudo mkdir -p /etc/sglang/
sudo cp firered_cache_dit_config.yaml /etc/sglang/firered_cache_dit_config.yaml
sudo cp sglang-firered-image-edit-1-1.service
sudo systemctl daemon-reload
sudo systemctl start sglang-firered-image-edit-1-1.service
sudo systemctl status sglang-firered-image-edit-1-1.service
sudo systemctl enable sglang-firered-image-edit-1-1.service

Prompt

Add something like:

Ultra sharp, 4K quality.

Web Proxy

Set up via apache. Some config snippets:

        # 1. Redirect /gradio to /gradio/ (trailing slash)
        RewriteRule ^/gradio$ /gradio/ [R=301,L]
        # 2. WebSocket proxy
        RewriteCond %{HTTP:Upgrade} =websocket [NC]
        RewriteRule ^/gradio/(.*) ws://10.68.68.249:7860/$1 [P,L]
        # 3. HTTP proxy
        ProxyPass /gradio/ http://10.68.68.249:7860/
        ProxyPassReverse /gradio/ http://10.68.68.249:7860/
        # Block cloudflare serving (meh, still does DNS):
        LoadModule substitute_module modules/mod_substitute.so
        <Location /gradio>
                AddOutputFilterByType SUBSTITUTE text/html
                Substitute "s|https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js|data:text/javascript,|i"
        </Location>
        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Host "proxy.deepcrayon.org"

License

Apache 2.0.

Copyright © 2026 Jeff Moe.