Spaces:
Running
Running
File size: 13,565 Bytes
e1e48c6 aaef88a e1e48c6 43198da e1e48c6 aaef88a e1e48c6 43198da e1e48c6 43198da e1e48c6 627e508 e1e48c6 627e508 e1e48c6 43198da e1e48c6 43198da e1e48c6 627e508 e1e48c6 627e508 e1e48c6 627e508 e1e48c6 43198da e1e48c6 43198da e1e48c6 aaef88a 1130c6a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Qwen-Image — text-to-image foundation model</title>
<meta name="description" content="Reference for Qwen-Image, Alibaba's open text-to-image foundation model, with emphasis on in-image text rendering. Includes diffusers and hosted API usage." />
<link rel="canonical" href="https://wavespeed.ai/models/wavespeed-ai/qwen-image/text-to-image?utm_source=huggingface&utm_medium=space&utm_campaign=qwen_image" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Qwen-Image — text-to-image foundation model" />
<meta property="og:description" content="Reference for Qwen-Image, Alibaba's open text-to-image foundation model, with emphasis on in-image text rendering. Includes diffusers and hosted API usage." />
<meta property="og:url" content="https://wavespeed.ai/models/wavespeed-ai/qwen-image/text-to-image" />
<meta property="og:image" content="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/merge3.jpg" />
<meta name="twitter:card" content="summary_large_image" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<header class="site-header">
<div class="wrap">
<a class="brand" href="https://wavespeed.ai?utm_source=huggingface&utm_medium=space&utm_campaign=qwen_image" target="_blank" rel="noopener">
<span class="brand-mark" aria-hidden="true"></span>
<span>WaveSpeed AI</span>
</a>
<nav class="header-nav">
<a class="jump opt" href="#overview">Overview</a>
<a class="jump opt" href="#strengths">What it does well</a>
<a class="jump" href="#run">Run it</a>
<a class="jump opt" href="#local">Local</a>
<a class="jump" href="#resources">Resources</a>
<a href="https://wavespeed.ai/models/wavespeed-ai/qwen-image/text-to-image?utm_source=huggingface&utm_medium=space&utm_campaign=qwen_image" target="_blank" rel="noopener">wavespeed.ai ↗</a>
</nav>
</div>
</header>
<main class="wrap">
<div class="hero">
<p class="eyebrow">Alibaba Cloud · Qwen Team</p>
<h1>Qwen-Image</h1>
<p class="lede">An open image generation foundation model in the Qwen series. Its distinguishing strength is rendering legible text inside the image — including Chinese — rather than the smeared glyphs most diffusion models produce.</p>
<ul class="meta">
<li><b>Developer</b> Alibaba Cloud Qwen Team</li>
<li><b>Task</b> text-to-image</li>
<li><b>License</b> Apache-2.0</li>
<li><b>Weights</b> open</li>
</ul>
</div>
<section id="overview">
<h2>Overview</h2>
<p class="section-note">Qwen-Image is a general-purpose text-to-image model that also handles editing and several image-understanding tasks. The authors' benchmark summary is reproduced below.</p>
<div class="figure-single">
<figure>
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/merge3.jpg" alt="Grid of Qwen-Image sample outputs" loading="lazy" />
<figcaption>Sample outputs from the official release.</figcaption>
</figure>
</div>
</section>
<section id="bench">
<h2>Reported benchmarks</h2>
<p class="section-note">Published by the Qwen team with the model release. These are the authors' own figures and have not been independently reproduced here.</p>
<div class="figure-single">
<figure>
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/bench.png" alt="Qwen-Image benchmark chart" loading="lazy" />
<figcaption>Benchmark summary from the Qwen-Image model card.</figcaption>
</figure>
</div>
</section>
<section id="strengths">
<h2>What it does well</h2>
<div class="grid">
<div class="card">
<h3>Text inside the image</h3>
<p>Typography is generated as part of the scene, holding layout and letterforms together for both alphabetic scripts and Chinese — the capability the model is built around.</p>
</div>
<div class="card">
<h3>Style range</h3>
<p>Photographic, painterly, anime and flat-design outputs all come from the same checkpoint, steered by prompt rather than by LoRA.</p>
</div>
<div class="card">
<h3>Editing operations</h3>
<p>Style transfer, object insertion and removal, detail enhancement and text replacement inside an existing image.</p>
</div>
<div class="card">
<h3>Understanding tasks</h3>
<p>Detection, segmentation, depth and edge estimation, novel view synthesis and super-resolution, framed as conditional generation.</p>
</div>
</div>
</section>
<section id="showcase">
<h2>Showcase</h2>
<div class="figure-grid">
<figure>
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/s1.jpg" alt="Text rendering examples" loading="lazy" />
<figcaption><b>Text rendering.</b> Signage and dense copy integrated into the scene.</figcaption>
</figure>
<figure>
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/s2.jpg" alt="Artistic style examples" loading="lazy" />
<figcaption><b>Styles.</b> Photoreal through to illustrative, one checkpoint.</figcaption>
</figure>
<figure>
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/s3.jpg" alt="Image editing examples" loading="lazy" />
<figcaption><b>Editing.</b> Insertion, removal and in-image text edits.</figcaption>
</figure>
<figure>
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/s4.jpg" alt="Image understanding examples" loading="lazy" />
<figcaption><b>Understanding.</b> Depth, edges, segmentation and view synthesis.</figcaption>
</figure>
</div>
</section>
<section id="run">
<h2>Run it</h2>
<p class="section-note">The hosted endpoint runs the same weights without a local GPU.</p>
<div class="code">
<div class="code-tabs" role="tablist">
<button type="button" role="tab" aria-selected="true" data-panel="run-0">cURL</button>
<button type="button" role="tab" aria-selected="false" data-panel="run-1">Python</button>
<button type="button" role="tab" aria-selected="false" data-panel="run-2">JavaScript</button>
</div>
<pre id="run-0" role="tabpanel"><code># 1. submit the job
curl -X POST "https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image/text-to-image" \
-H "Authorization: Bearer $WAVESPEED_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A chalkboard outside a coffee shop reading \"Qwen Coffee \u2014 $2 a cup\", warm morning light, shallow depth of field",
"size": "1328*1328",
"enable_sync_mode": false
}'
# -> {"code": 200, "data": {"id": "<request-id>", "status": "created", ...}}
# 2. poll until status is "completed"
curl "https://api.wavespeed.ai/api/v3/predictions/<request-id>/result" \
-H "Authorization: Bearer $WAVESPEED_API_KEY"
# -> {"code": 200, "data": {"status": "completed", "outputs": ["https://..."]}}</code></pre>
<pre id="run-1" role="tabpanel" hidden><code>import os, time, requests
API = "https://api.wavespeed.ai/api/v3"
KEY = os.environ["WAVESPEED_API_KEY"]
HEADERS = {"Authorization": f"Bearer {KEY}"}
# submit
res = requests.post(
f"{API}/wavespeed-ai/qwen-image/text-to-image",
headers={**HEADERS, "Content-Type": "application/json"},
json={
"prompt": "A chalkboard outside a coffee shop reading \"Qwen Coffee \u2014 $2 a cup\", warm morning light, shallow depth of field",
"size": "1328*1328",
"enable_sync_mode": false
},
timeout=30,
)
res.raise_for_status()
request_id = res.json()["data"]["id"]
# poll
while True:
data = requests.get(
f"{API}/predictions/{request_id}/result",
headers=HEADERS,
timeout=30,
).json()["data"]
if data["status"] == "completed":
print(data["outputs"][0])
break
if data["status"] == "failed":
raise RuntimeError(data.get("error", "generation failed"))
time.sleep(1.5)</code></pre>
<pre id="run-2" role="tabpanel" hidden><code>const API = "https://api.wavespeed.ai/api/v3";
const KEY = process.env.WAVESPEED_API_KEY;
const headers = { Authorization: `Bearer ${KEY}` };
// submit
const submit = await fetch(`${API}/wavespeed-ai/qwen-image/text-to-image`, {
method: "POST",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
"prompt": "A chalkboard outside a coffee shop reading \"Qwen Coffee \u2014 $2 a cup\", warm morning light, shallow depth of field",
"size": "1328*1328",
"enable_sync_mode": false
}),
});
const { data: { id } } = await submit.json();
// poll
for (;;) {
const res = await fetch(`${API}/predictions/${id}/result`, { headers });
const { data } = await res.json();
if (data.status === "completed") {
console.log(data.outputs[0]);
break;
}
if (data.status === "failed") throw new Error(data.error ?? "generation failed");
await new Promise((r) => setTimeout(r, 1500));
}</code></pre>
</div>
<div class="callout"><p>Requests are asynchronous: <code>POST</code> returns a request id, then you poll <code>/predictions/<id>/result</code> until <code>status</code> is <code>completed</code>. Set <code>enable_sync_mode: true</code> to have the call block and return outputs directly.</p><p>API keys are created in the <a href="https://wavespeed.ai/dashboard?utm_source=huggingface&utm_medium=space&utm_campaign=qwen_image" target="_blank" rel="noopener">WaveSpeed dashboard</a>.</p></div>
<div class="btn-row">
<a class="btn" href="https://wavespeed.ai/models/wavespeed-ai/qwen-image/text-to-image?utm_source=huggingface&utm_medium=space&utm_campaign=qwen_image" target="_blank" rel="noopener">Open on WaveSpeed</a>
<a class="btn secondary" href="https://wavespeed.ai/docs?utm_source=huggingface&utm_medium=space&utm_campaign=qwen_image" target="_blank" rel="noopener">API reference</a>
</div>
</section>
<section id="local">
<h2>Running locally</h2>
<p class="section-note">Weights are Apache-2.0 and load through <code>diffusers</code>.</p>
<div class="code">
<div class="code-tabs" role="tablist">
<button type="button" role="tab" aria-selected="true" data-panel="local-0">Python</button>
</div>
<pre id="local-0" role="tabpanel"><code>import torch
from diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained(
"Qwen/Qwen-Image",
torch_dtype=torch.bfloat16,
).to("cuda")
# The Qwen team recommends appending a quality suffix to the prompt.
magic = {"en": "Ultra HD, 4K, cinematic composition.", "zh": "超清,4K,电影级构图"}
image = pipe(
prompt='A chalkboard reading "Qwen Coffee — $2 a cup". ' + magic["en"],
negative_prompt=" ",
width=1664,
height=928, # 1:1 1328x1328 · 16:9 1664x928 · 4:3 1472x1140
num_inference_steps=50,
true_cfg_scale=4.0,
generator=torch.Generator(device="cuda").manual_seed(42),
).images[0]
image.save("out.png")</code></pre>
</div>
</section>
<section id="resources">
<h2>Resources</h2>
<ul class="links">
<li><a href="https://huggingface.co/Qwen/Qwen-Image" target="_blank" rel="noopener"><span>Qwen/Qwen-Image weights</span><span class="host">huggingface.co</span></a></li>
<li><a href="https://github.com/QwenLM/Qwen-Image" target="_blank" rel="noopener"><span>Qwen-Image on GitHub</span><span class="host">github.com</span></a></li>
<li><a href="https://wavespeed.ai/models/wavespeed-ai/qwen-image/text-to-image?utm_source=huggingface&utm_medium=space&utm_campaign=qwen_image" target="_blank" rel="noopener"><span>Hosted endpoint</span><span class="host">wavespeed.ai</span></a></li>
<li><a href="https://huggingface.co/spaces/wavespeed/qwen-edit-image" target="_blank" rel="noopener"><span>Editing variant</span><span class="host">huggingface.co</span></a></li>
</ul>
</section>
</main>
<footer class="site-footer">
<div class="wrap">
<p>This page is a model reference maintained by WaveSpeed AI. The model itself is developed and released by its respective authors; trademarks belong to them. WaveSpeed AI provides hosted inference for it.</p>
<div class="footer-links">
<a href="https://wavespeed.ai?utm_source=huggingface&utm_medium=space&utm_campaign=qwen_image" target="_blank" rel="noopener">WaveSpeed AI</a>
<a href="https://wavespeed.ai/docs?utm_source=huggingface&utm_medium=space&utm_campaign=qwen_image" target="_blank" rel="noopener">Docs</a>
<a href="https://huggingface.co/wavespeed" target="_blank" rel="noopener">Hugging Face</a>
</div>
</div>
</footer>
<script src="tabs.js"></script>
</body>
</html>
|