--- title: Qwen-Image-2.1 Prompt Enhancer emoji: ✍️ colorFrom: indigo colorTo: pink sdk: gradio sdk_version: 6.28.0 app_file: app.py short_description: Official prompt rewriters for Qwen-Image-2.1, kept warm python_version: "3.12" startup_duration_timeout: 1h license: other license_name: qwen-research license_link: https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE --- # Qwen-Image-2.1 Prompt Enhancer Prompt-enhancement service behind the [Qwen-Image-2.1](https://huggingface.co/Qwen/Qwen-Image-2.1) demo. It hosts both official rewriting models on one ZeroGPU worker: | Model | Used when | |---|---| | [`Qwen/Qwen-Image-2.1-PE-T2I`](https://huggingface.co/Qwen/Qwen-Image-2.1-PE-T2I) | no input images — expands a short brief into a long English prompt + aspect ratio | | [`Qwen/Qwen-Image-2.1-PE-I2I`](https://huggingface.co/Qwen/Qwen-Image-2.1-PE-I2I) | input images present — turns a vague edit instruction into a precise directive | Both are loaded at module scope and moved to CUDA eagerly, so ZeroGPU packs them at startup and they stay resident on the worker across calls — no per-request cold load. ## API ```python from gradio_client import Client, handle_file client = Client("hugging-apps/qwen-image-2-1-prompt-enhancer") rewritten, wh_ratio, raw, seed, elapsed = client.predict( prompt="a corgi playing guitar in the rain", image_paths=[], # or [handle_file("photo.png"), ...] for editing api_name="/enhance", ) ``` ## License and attribution The rewriting models are released under the [Qwen Research License Agreement](https://huggingface.co/Qwen/Qwen-Image-2.1/blob/main/LICENSE) — research / evaluation use only. > Qwen is licensed under the Qwen RESEARCH LICENSE AGREEMENT, Copyright (c) 2026 > Hangzhou Tongyi Laboratory Technology Co., Ltd. All Rights Reserved.