lulavc/Z-Image-Turbo
⚡ Z-Image Turbo
Ultra-fast text-to-image generation powered by [Tongyi-MAI/Z-Image-Turbo](https://huggingface.co/Tongyi-MAI/Z-Image-Turbo) — a single-stream Diffusion Transformer that produces stunning, high-quality images in just 8 steps.
✨ Features
🖼️ Resolution Presets
Standard (1024-range)
Large (1280+)
Note: Large presets require more VRAM. If you get an out-of-memory error, switch to a Standard preset or reduce the number of steps.
🌐 Language Support
The full UI (labels, placeholders, buttons, error messages) is available in 4 languages. Switch with the language selector at the top of the control panel:
You can write prompts in any language — the model handles multilingual input natively.
✨ AI Prompt Enhancer
Click the ✨ Enhance Prompt button to automatically improve your prompt using a large language model.
What it does:
- Locks in your core subject and intent
- Adds professional lighting, composition, and material details
- Applies cinematic or photographic aesthetics
- Handles text elements with precise quotation formatting
Example:
- Input:
"a woman in a red dress" - Enhanced:
"Cinematic close-up portrait of a woman in a flowing crimson silk dress. Soft rim lighting from the left, deep shadow on the right side of her face. Shallow depth of field, f/1.8, bokeh background of blurred warm golden lights. High fashion editorial style, Leica M10 film grain."
The enhancer uses Qwen/Qwen2.5-7B-Instruct via the HF Inference API. Generation continues normally even if enhancement is unavailable.
🎯 Quality Presets
Quick presets to balance speed and quality:
Note: Z-Image Turbo is optimized for lower guidance scales than base models. Values above 5.0 may cause oversaturation and blown highlights.
⚙️ Advanced Settings
🤖 MCP Server
This Space runs as an MCP (Model Context Protocol) server, allowing it to be used as a tool by AI agents.
Using with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"z-image-turbo": {
"url": "https://lulavc-z-image-turbo.hf.space/gradio_api/mcp/sse"
}
}
}Using with any MCP client
- SSE endpoint:
https://lulavc-z-image-turbo.hf.space/gradio_api/mcp/sse - Tool name:
generate - Parameters:
prompt,negative_prompt,resolution,steps,guidance_scale,shift,seed,random_seed
🔧 Technical Details
Model Architecture
- Name: Tongyi-MAI/Z-Image-Turbo
- Architecture: Z-Image — single-stream Diffusion Transformer (DiT)
- Scheduler: FlowMatch Euler Discrete with configurable time shift
- Precision: bfloat16
- License: Apache 2.0
Acceleration Stack
AoTI FA3 (flash-attn3 kernel)
↓ fallback
AoTI standard (compiled transformer blocks)
↓ fallback
Standard PyTorch inferencespaces.aoti_blocks_load pre-compiles the transformer blocks using Torch's Ahead-of-Time Inductor, significantly reducing per-step latency. The space automatically uses the best available kernel.
Infrastructure
- Hardware: ZeroGPU — NVIDIA H200 (141 GB HBM3e)
- Framework: Gradio 6.0.2
- Scheduler cache: Shift-keyed cache avoids re-instantiation on every call
- GPU memory:
torch.cuda.empty_cache()called after every generation
💡 Tips for Best Results
- Be specific — describe lighting, style, mood, camera angle, and materials
- Name a style — "cinematic", "documentary", "concept art", "Studio Ghibli", "Leica film grain"
- Use the Enhancer — click ✨ Enhance Prompt before generating for dramatically richer output
- Start with Balanced preset — default guidance scale 1.0 provides optimal quality/speed balance
- Use Quality preset for important work — guidance scale 3.5 significantly improves detail without oversaturation
- Maximum preset for final output — guidance scale 5.0 with 10 steps provides highest quality
- Avoid high guidance scales — values above 5.0 can cause oversaturation and color artifacts in Turbo models
- Time Shift 3 — good default; try higher (5–7) for more detailed textures
- Fix your seed — uncheck Random Seed, copy the seed after a good generation, reuse it with tweaks
- Negative prompts —
blur, deformed hands, watermark, low qualitywork well as defaults
🛠️ Running Locally
git clone https://huggingface.co/spaces/lulavc/Z-Image-Turbo
cd Z-Image-Turbo
pip install -r requirements.txt
python app.pyRequires a CUDA-capable GPU with at least 16 GB VRAM for 1024×1024. Set HF_TOKEN in your environment for prompt enhancement.
📄 License
- Space code: MIT
- Model weights: Apache 2.0
Space by [lulavc](https://huggingface.co/lulavc) · Powered by Tongyi-MAI/Z-Image-Turbo · ZeroGPU · A10G
