title: Qwen Image Edit Rapid AIO (NSFW) emoji: 🌠colorFrom: pink colorTo: pink sdk: gradio sdk_version: 6.1.0 app_file: app.py pinned: true tags:
This repo now contains two deployment paths:
app.py keeps the original Hugging Face Space UI flow.handler.py + runpod_inference.py provide a Runpod Serverless worker.handler.py: Runpod entrypoint.runpod_inference.py: model loading, request parsing, inference, and image serialization.Dockerfile: container image for Runpod.requirements.runpod.txt: Python dependencies for the worker image..dockerignore: keeps the image build smaller and cleaner..env.runpod.example: environment variable template.test_input.json: local Runpod SDK smoke-test payload.This model stack is large:
Qwen/Qwen-Image-Edit-2511 is listed on Hugging Face at about 57.7 GB.Phr00t/Qwen-Image-Edit-Rapid-AIO v23 checkpoint is roughly 28 GB.Because of that, use these as your starting assumptions:
120 GB, with 150 GB safer.80 GB class GPU if you want the highest chance of a first-pass success.max workers = 1 until you confirm memory, boot time, and cost.The Runpod handler accepts payloads like this:
{
"input": {
"prompt": "Replace Pikachu's sign text with \"Runpod ready\" while preserving the yarn art style.",
"images": [
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/yarn-art-pikachu.png"
],
"seed": 42,
"randomize_seed": false,
"quality_mode": "balanced",
"rewrite_prompt": false,
"face_mask_strategy": "smart",
"face_mask_mode": "surface_fx",
"face_mask_strength": 0.86,
"debug_masks": false,
"postprocess_upscale_mode": "detail",
"num_images_per_prompt": 1,
"height": null,
"width": null,
"output_format": "png",
"upload_to_bucket": false
}
}
images: list of image URLs, local paths, base64 strings, or { "url" | "base64" | "path" } objects.image, image_url, image_urls, image_base64, image_base64s: accepted as aliases.The worker returns:
statusseedpromptresolved_promptimagesface_mask_strategyface_mask_modeface_maskingdebug_masksgenerationtimingsmodelEach output image contains an image_url value. By default this is a data URI (data:image/...;base64,...). If you enable bucket uploads, it becomes the uploaded file URL.
This checks the Runpod handler flow without downloading the model:
$env:RUNPOD_SKIP_MODEL_LOAD="1"
python handler.py --rp_server_api
Use this only on a machine with a suitable NVIDIA GPU and enough disk space:
pip install -r requirements.runpod.txt
python handler.py --rp_server_api
The SDK uses test_input.json by default for local testing.
If you want a simple upload-and-prompt UI for testing the deployed Runpod endpoint, use:
runpod_test_client.pyrequirements.client.txtStart it locally:
pip install -r requirements.client.txt
python runpod_test_client.py
Then open:
http://127.0.0.1:7861
The client lets you:
Lock Face Identity enabled to preserve the source face during editsMask Strategy:smart uses parsing-aware masks, region-aware blending, adaptive sizing, and surface-safe editingauto uses the smart path but falls back to the old landmark-only behavior if the parser path is unavailablelegacy forces the previous landmark-only behaviorFace Mask Mode:surface_fx is the new best default for liquids, makeup, wet skin, lashes, and other surface-only editsbalanced preserves identity more broadly while still allowing moderate face editsstrict locks identity-critical regions most aggressivelyoff disables face protectionMask Strength to tune how strongly the source face is preservedAuto Steps and Auto Guidance enabled if you want the worker to pick better values automaticallyQuality Mode to trade speed vs image qualityDebug Masks to return parser labels, region masks, and overlays for the first output imageUpscale Mode for the final postprocess stage after maskingWidth and Height blank to use the higher-quality automatic native render sizeWidth and Height manually if you want a custom native resolutionYou can use either path:
GitHub import is usually simpler for a first deployment.
In Runpod:
New Endpoint.Queue.If you use GitHub import:
DockerfileUse conservative settings first:
80 GB.01300 to 900 seconds is a good starting point for this model.1800 seconds120 GB minimum, 150 GB preferredIn the endpoint settings, set the Model field to:
Qwen/Qwen-Image-Edit-2511
That tells Runpod to pre-cache the 57.7 GB base model and mount it into the worker at /runpod-volume/huggingface-cache/hub.
The base model can use Runpod cached models, but the extra v23 checkpoint is a second Hugging Face artifact.
Recommended setup:
HF_HOME=/runpod-volume/hf-home
HUGGINGFACE_HUB_CACHE=/runpod-volume/hf-home/hub
TRANSFORMERS_CACHE=/runpod-volume/hf-home/hub
If you skip the network volume, the checkpoint can still download, but future cold starts may have to fetch it again.
Start with these:
BASE_MODEL_ID=Qwen/Qwen-Image-Edit-2511
CHECKPOINT_REPO_ID=Phr00t/Qwen-Image-Edit-Rapid-AIO
CHECKPOINT_FILENAME=v23/Qwen-Rapid-AIO-NSFW-v23.safetensors
DEFAULT_NUM_INFERENCE_STEPS=6
DEFAULT_TRUE_GUIDANCE_SCALE=1.3
MIN_IDENTITY_TRUE_GUIDANCE_SCALE=1.3
DEFAULT_REWRITE_PROMPT=false
FACE_MASK_STRATEGY=smart
FACE_MASK_MODE=surface_fx
FACE_MASK_STRENGTH=0.86
FACE_MASK_DEBUG=false
QUALITY_MODE=balanced
ADAPTIVE_GENERATION=true
MIN_NATIVE_LONG_EDGE=1536
MIN_NATIVE_SHORT_EDGE=1216
MIN_NATIVE_PIXELS=2179072
MAX_NATIVE_LONG_EDGE=2048
GENERATION_SIZE_MULTIPLE=32
MIN_OUTPUT_LONG_EDGE=1920
MIN_OUTPUT_SHORT_EDGE=1080
MIN_OUTPUT_PIXELS=2073600
POSTPROCESS_UPSCALE_MODE=detail
RUNPOD_USE_CACHED_BASE_MODEL=true
RUNPOD_ENABLE_BUCKET_UPLOADS=
OOM_RETRY_ATTEMPTS=2
OOM_RETRY_SCALE=0.86
OOM_RETRY_MIN_STEPS=4
RUNPOD_INIT_TIMEOUT=1800
Optional:
HF_TOKEN: only needed for gated/private Hugging Face assets.HF_INFERENCE_API_KEY: only needed if you want rewrite_prompt=true.BUCKET_ENDPOINT_URL, BUCKET_ACCESS_KEY_ID, BUCKET_SECRET_ACCESS_KEY: if these are present and RUNPOD_ENABLE_BUCKET_UPLOADS is left empty, the worker auto-switches to uploaded URLs.FACE_MASK_STRATEGY=legacy: forces the previous landmark-only masking behavior if you want a runtime fallback without changing branches.You can copy these from .env.runpod.example.
Click deploy, then watch:
The first worker boot will be slow because it has to:
Replace YOUR_ENDPOINT_ID and YOUR_API_KEY:
curl -X POST "https://api.runpod.ai/v2/YOUR_ENDPOINT_ID/runsync" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d @test_input.json
If you prefer async:
curl -X POST "https://api.runpod.ai/v2/YOUR_ENDPOINT_ID/run" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d @test_input.json
Then poll:
curl "https://api.runpod.ai/v2/YOUR_ENDPOINT_ID/status/JOB_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
By default, each result image is returned as a data URI in:
output.images[0].image_url
If you enable bucket uploads, the same field contains a normal URL instead.
rewrite_prompt disabled unless you really want it. It adds an external dependency and extra latency.max workers = 1 until you know the model fits comfortably on your chosen GPU type.You now have two ways to fall back to the previous behavior:
FACE_MASK_STRATEGY=legacy or send "face_mask_strategy": "legacy" in the request payload.codex/pre-face-parsing-upgrade, which points to the exact pre-upgrade commit.The runtime fallback is the fastest option if you only want the old masking behavior. The Git fallback is the safest option if you want the entire worker stack back exactly as it was before the parser-driven upgrade.
Dockerfile: change the base image or baked defaults.requirements.runpod.txt: adjust Python packages.runpod_inference.py: change input schema, output schema, model loading, or checkpoint logic..env.runpod.example: keep your environment variable reference up to date.The original Gradio application remains in app.py. The Runpod files are additive and do not remove the original Space path.
Python
99.2%
title: Qwen Image Edit Rapid AIO (NSFW) emoji: 🌠colorFrom: pink colorTo: pink sdk: gradio sdk_version: 6.1.0 app_file: app.py pinned: true tags:
This repo now contains two deployment paths:
app.py keeps the original Hugging Face Space UI flow.handler.py + runpod_inference.py provide a Runpod Serverless worker.handler.py: Runpod entrypoint.runpod_inference.py: model loading, request parsing, inference, and image serialization.Dockerfile: container image for Runpod.requirements.runpod.txt: Python dependencies for the worker image..dockerignore: keeps the image build smaller and cleaner..env.runpod.example: environment variable template.test_input.json: local Runpod SDK smoke-test payload.This model stack is large:
Qwen/Qwen-Image-Edit-2511 is listed on Hugging Face at about 57.7 GB.Phr00t/Qwen-Image-Edit-Rapid-AIO v23 checkpoint is roughly 28 GB.Because of that, use these as your starting assumptions:
120 GB, with 150 GB safer.80 GB class GPU if you want the highest chance of a first-pass success.max workers = 1 until you confirm memory, boot time, and cost.The Runpod handler accepts payloads like this:
{
"input": {
"prompt": "Replace Pikachu's sign text with \"Runpod ready\" while preserving the yarn art style.",
"images": [
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/yarn-art-pikachu.png"
],
"seed": 42,
"randomize_seed": false,
"quality_mode": "balanced",
"rewrite_prompt": false,
"face_mask_strategy": "smart",
"face_mask_mode": "surface_fx",
"face_mask_strength": 0.86,
"debug_masks": false,
"postprocess_upscale_mode": "detail",
"num_images_per_prompt": 1,
"height": null,
"width": null,
"output_format": "png",
"upload_to_bucket": false
}
}
images: list of image URLs, local paths, base64 strings, or { "url" | "base64" | "path" } objects.image, image_url, image_urls, image_base64, image_base64s: accepted as aliases.The worker returns:
statusseedpromptresolved_promptimagesface_mask_strategyface_mask_modeface_maskingdebug_masksgenerationtimingsmodelEach output image contains an image_url value. By default this is a data URI (data:image/...;base64,...). If you enable bucket uploads, it becomes the uploaded file URL.
This checks the Runpod handler flow without downloading the model:
$env:RUNPOD_SKIP_MODEL_LOAD="1"
python handler.py --rp_server_api
Use this only on a machine with a suitable NVIDIA GPU and enough disk space:
pip install -r requirements.runpod.txt
python handler.py --rp_server_api
The SDK uses test_input.json by default for local testing.
If you want a simple upload-and-prompt UI for testing the deployed Runpod endpoint, use:
runpod_test_client.pyrequirements.client.txtStart it locally:
pip install -r requirements.client.txt
python runpod_test_client.py
Then open:
http://127.0.0.1:7861
The client lets you:
Lock Face Identity enabled to preserve the source face during editsMask Strategy:smart uses parsing-aware masks, region-aware blending, adaptive sizing, and surface-safe editingauto uses the smart path but falls back to the old landmark-only behavior if the parser path is unavailablelegacy forces the previous landmark-only behaviorFace Mask Mode:surface_fx is the new best default for liquids, makeup, wet skin, lashes, and other surface-only editsbalanced preserves identity more broadly while still allowing moderate face editsstrict locks identity-critical regions most aggressivelyoff disables face protectionMask Strength to tune how strongly the source face is preservedAuto Steps and Auto Guidance enabled if you want the worker to pick better values automaticallyQuality Mode to trade speed vs image qualityDebug Masks to return parser labels, region masks, and overlays for the first output imageUpscale Mode for the final postprocess stage after maskingWidth and Height blank to use the higher-quality automatic native render sizeWidth and Height manually if you want a custom native resolutionYou can use either path:
GitHub import is usually simpler for a first deployment.
In Runpod:
New Endpoint.Queue.If you use GitHub import:
DockerfileUse conservative settings first:
80 GB.01300 to 900 seconds is a good starting point for this model.1800 seconds120 GB minimum, 150 GB preferredIn the endpoint settings, set the Model field to:
Qwen/Qwen-Image-Edit-2511
That tells Runpod to pre-cache the 57.7 GB base model and mount it into the worker at /runpod-volume/huggingface-cache/hub.
The base model can use Runpod cached models, but the extra v23 checkpoint is a second Hugging Face artifact.
Recommended setup:
HF_HOME=/runpod-volume/hf-home
HUGGINGFACE_HUB_CACHE=/runpod-volume/hf-home/hub
TRANSFORMERS_CACHE=/runpod-volume/hf-home/hub
If you skip the network volume, the checkpoint can still download, but future cold starts may have to fetch it again.
Start with these:
BASE_MODEL_ID=Qwen/Qwen-Image-Edit-2511
CHECKPOINT_REPO_ID=Phr00t/Qwen-Image-Edit-Rapid-AIO
CHECKPOINT_FILENAME=v23/Qwen-Rapid-AIO-NSFW-v23.safetensors
DEFAULT_NUM_INFERENCE_STEPS=6
DEFAULT_TRUE_GUIDANCE_SCALE=1.3
MIN_IDENTITY_TRUE_GUIDANCE_SCALE=1.3
DEFAULT_REWRITE_PROMPT=false
FACE_MASK_STRATEGY=smart
FACE_MASK_MODE=surface_fx
FACE_MASK_STRENGTH=0.86
FACE_MASK_DEBUG=false
QUALITY_MODE=balanced
ADAPTIVE_GENERATION=true
MIN_NATIVE_LONG_EDGE=1536
MIN_NATIVE_SHORT_EDGE=1216
MIN_NATIVE_PIXELS=2179072
MAX_NATIVE_LONG_EDGE=2048
GENERATION_SIZE_MULTIPLE=32
MIN_OUTPUT_LONG_EDGE=1920
MIN_OUTPUT_SHORT_EDGE=1080
MIN_OUTPUT_PIXELS=2073600
POSTPROCESS_UPSCALE_MODE=detail
RUNPOD_USE_CACHED_BASE_MODEL=true
RUNPOD_ENABLE_BUCKET_UPLOADS=
OOM_RETRY_ATTEMPTS=2
OOM_RETRY_SCALE=0.86
OOM_RETRY_MIN_STEPS=4
RUNPOD_INIT_TIMEOUT=1800
Optional:
HF_TOKEN: only needed for gated/private Hugging Face assets.HF_INFERENCE_API_KEY: only needed if you want rewrite_prompt=true.BUCKET_ENDPOINT_URL, BUCKET_ACCESS_KEY_ID, BUCKET_SECRET_ACCESS_KEY: if these are present and RUNPOD_ENABLE_BUCKET_UPLOADS is left empty, the worker auto-switches to uploaded URLs.FACE_MASK_STRATEGY=legacy: forces the previous landmark-only masking behavior if you want a runtime fallback without changing branches.You can copy these from .env.runpod.example.
Click deploy, then watch:
The first worker boot will be slow because it has to:
Replace YOUR_ENDPOINT_ID and YOUR_API_KEY:
curl -X POST "https://api.runpod.ai/v2/YOUR_ENDPOINT_ID/runsync" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d @test_input.json
If you prefer async:
curl -X POST "https://api.runpod.ai/v2/YOUR_ENDPOINT_ID/run" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d @test_input.json
Then poll:
curl "https://api.runpod.ai/v2/YOUR_ENDPOINT_ID/status/JOB_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
By default, each result image is returned as a data URI in:
output.images[0].image_url
If you enable bucket uploads, the same field contains a normal URL instead.
rewrite_prompt disabled unless you really want it. It adds an external dependency and extra latency.max workers = 1 until you know the model fits comfortably on your chosen GPU type.You now have two ways to fall back to the previous behavior:
FACE_MASK_STRATEGY=legacy or send "face_mask_strategy": "legacy" in the request payload.codex/pre-face-parsing-upgrade, which points to the exact pre-upgrade commit.The runtime fallback is the fastest option if you only want the old masking behavior. The Git fallback is the safest option if you want the entire worker stack back exactly as it was before the parser-driven upgrade.
Dockerfile: change the base image or baked defaults.requirements.runpod.txt: adjust Python packages.runpod_inference.py: change input schema, output schema, model loading, or checkpoint logic..env.runpod.example: keep your environment variable reference up to date.The original Gradio application remains in app.py. The Runpod files are additive and do not remove the original Space path.
Python
99.2%