qwen-edit-image / index.html
chengzeyi's picture
Add UTM attribution to outbound wavespeed.ai links
7ea74c5
Raw History Blame Contribute Delete
12.3 kB
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Qwen-Image-Edit — instruction-based image editing</title>
<meta name="description" content="Reference for Qwen-Image-Edit, Alibaba&#x27;s open instruction-driven image editing model, with hosted API usage and local diffusers setup." />
<link rel="canonical" href="https://wavespeed.ai/models/wavespeed-ai/qwen-image/edit?utm_source=huggingface&amp;utm_medium=space&amp;utm_campaign=qwen_edit_image" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Qwen-Image-Edit — instruction-based image editing" />
<meta property="og:description" content="Reference for Qwen-Image-Edit, Alibaba&#x27;s open instruction-driven image editing model, with hosted API usage and local diffusers setup." />
<meta property="og:url" content="https://wavespeed.ai/models/wavespeed-ai/qwen-image/edit" />
<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&amp;utm_medium=space&amp;utm_campaign=qwen_edit_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="#edits">Edit types</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/edit?utm_source=huggingface&amp;utm_medium=space&amp;utm_campaign=qwen_edit_image" target="_blank" rel="noopener">wavespeed.ai &#8599;</a>
</nav>
</div>
</header>
<main class="wrap">
<div class="hero">
<p class="eyebrow">Alibaba Cloud · Qwen Team</p>
<h1>Qwen-Image-Edit</h1>
<p class="lede">The editing counterpart to Qwen-Image. It takes an existing image plus a written instruction and applies the change while leaving the rest of the frame — including identity and layout — intact.</p>
<ul class="meta">
<li><b>Developer</b> Alibaba Cloud Qwen Team</li>
<li><b>Task</b> instruction-based image editing</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">Editing is expressed as an instruction rather than a mask. The model inherits Qwen-Image's text rendering, which is what makes editing text already present in a photograph practical.</p>
<div class="figure-single">
<figure>
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/merge3.jpg" alt="Qwen-Image sample outputs" loading="lazy" />
<figcaption>Sample outputs from the Qwen-Image release.</figcaption>
</figure>
</div>
</section>
<section id="edits">
<h2>Edit types</h2>
<div class="grid">
<div class="card">
<h3>Semantic edits</h3>
<p>Change what is in the scene — add, remove or replace an object — while lighting and perspective stay consistent with the original.</p>
</div>
<div class="card">
<h3>Appearance edits</h3>
<p>Restyle or recolour without moving anything, so composition and structure survive the edit unchanged.</p>
</div>
<div class="card">
<h3>Text editing</h3>
<p>Replace words rendered inside the image while matching the existing font, perspective and surface — the capability inherited from Qwen-Image.</p>
</div>
<div class="card">
<h3>Identity preservation</h3>
<p>Faces and distinctive objects are held stable across the edit, which is what makes chained edits usable.</p>
</div>
</div>
</section>
<section id="variants">
<h2>Hosted variants</h2>
<div class="table-scroll">
<table>
<thead><tr><th>Endpoint</th><th>Notes</th></tr></thead>
<tbody>
<tr><td><code>wavespeed-ai/qwen-image/edit</code></td><td>Base instruction-driven editing.</td></tr>
<tr><td><code>wavespeed-ai/qwen-image/edit-plus</code></td><td>Updated editing checkpoint.</td></tr>
<tr><td><code>wavespeed-ai/qwen-image/edit-plus-lora</code></td><td>Editing with LoRA adapters applied.</td></tr>
</tbody>
</table>
</div>
</section>
<section id="run">
<h2>Run it</h2>
<p class="section-note">Pass a publicly reachable image URL, or upload first via <code>POST /media/upload/binary</code> and use the returned URL.</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 &quot;https://api.wavespeed.ai/api/v3/wavespeed-ai/qwen-image/edit&quot; \
-H &quot;Authorization: Bearer $WAVESPEED_API_KEY&quot; \
-H &quot;Content-Type: application/json&quot; \
-d &#x27;{
&quot;image&quot;: &quot;https://example.com/input.jpg&quot;,
&quot;prompt&quot;: &quot;Replace the text on the sign with \&quot;Open until 9pm\&quot;, keep the original font and perspective&quot;,
&quot;enable_sync_mode&quot;: false
}&#x27;
# -&gt; {&quot;code&quot;: 200, &quot;data&quot;: {&quot;id&quot;: &quot;&lt;request-id&gt;&quot;, &quot;status&quot;: &quot;created&quot;, ...}}
# 2. poll until status is &quot;completed&quot;
curl &quot;https://api.wavespeed.ai/api/v3/predictions/&lt;request-id&gt;/result&quot; \
-H &quot;Authorization: Bearer $WAVESPEED_API_KEY&quot;
# -&gt; {&quot;code&quot;: 200, &quot;data&quot;: {&quot;status&quot;: &quot;completed&quot;, &quot;outputs&quot;: [&quot;https://...&quot;]}}</code></pre>
<pre id="run-1" role="tabpanel" hidden><code>import os, time, requests
API = &quot;https://api.wavespeed.ai/api/v3&quot;
KEY = os.environ[&quot;WAVESPEED_API_KEY&quot;]
HEADERS = {&quot;Authorization&quot;: f&quot;Bearer {KEY}&quot;}
# submit
res = requests.post(
f&quot;{API}/wavespeed-ai/qwen-image/edit&quot;,
headers={**HEADERS, &quot;Content-Type&quot;: &quot;application/json&quot;},
json={
&quot;image&quot;: &quot;https://example.com/input.jpg&quot;,
&quot;prompt&quot;: &quot;Replace the text on the sign with \&quot;Open until 9pm\&quot;, keep the original font and perspective&quot;,
&quot;enable_sync_mode&quot;: false
},
timeout=30,
)
res.raise_for_status()
request_id = res.json()[&quot;data&quot;][&quot;id&quot;]
# poll
while True:
data = requests.get(
f&quot;{API}/predictions/{request_id}/result&quot;,
headers=HEADERS,
timeout=30,
).json()[&quot;data&quot;]
if data[&quot;status&quot;] == &quot;completed&quot;:
print(data[&quot;outputs&quot;][0])
break
if data[&quot;status&quot;] == &quot;failed&quot;:
raise RuntimeError(data.get(&quot;error&quot;, &quot;generation failed&quot;))
time.sleep(1.5)</code></pre>
<pre id="run-2" role="tabpanel" hidden><code>const API = &quot;https://api.wavespeed.ai/api/v3&quot;;
const KEY = process.env.WAVESPEED_API_KEY;
const headers = { Authorization: `Bearer ${KEY}` };
// submit
const submit = await fetch(`${API}/wavespeed-ai/qwen-image/edit`, {
method: &quot;POST&quot;,
headers: { ...headers, &quot;Content-Type&quot;: &quot;application/json&quot; },
body: JSON.stringify({
&quot;image&quot;: &quot;https://example.com/input.jpg&quot;,
&quot;prompt&quot;: &quot;Replace the text on the sign with \&quot;Open until 9pm\&quot;, keep the original font and perspective&quot;,
&quot;enable_sync_mode&quot;: 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 === &quot;completed&quot;) {
console.log(data.outputs[0]);
break;
}
if (data.status === &quot;failed&quot;) throw new Error(data.error ?? &quot;generation failed&quot;);
await new Promise((r) =&gt; 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/&lt;id&gt;/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&amp;utm_medium=space&amp;utm_campaign=qwen_edit_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/edit?utm_source=huggingface&amp;utm_medium=space&amp;utm_campaign=qwen_edit_image" target="_blank" rel="noopener">Open on WaveSpeed</a>
<a class="btn secondary" href="https://wavespeed.ai/docs?utm_source=huggingface&amp;utm_medium=space&amp;utm_campaign=qwen_edit_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 PIL import Image
from diffusers import QwenImageEditPipeline
pipe = QwenImageEditPipeline.from_pretrained(
&quot;Qwen/Qwen-Image-Edit&quot;,
torch_dtype=torch.bfloat16,
).to(&quot;cuda&quot;)
image = Image.open(&quot;input.jpg&quot;).convert(&quot;RGB&quot;)
out = pipe(
image=image,
prompt=&#x27;Replace the text on the sign with &quot;Open until 9pm&quot;, &#x27;
&quot;keep the original font and perspective&quot;,
negative_prompt=&quot; &quot;,
num_inference_steps=50,
true_cfg_scale=4.0,
generator=torch.Generator(device=&quot;cuda&quot;).manual_seed(42),
).images[0]
out.save(&quot;edited.png&quot;)</code></pre>
</div>
</section>
<section id="resources">
<h2>Resources</h2>
<ul class="links">
<li><a href="https://huggingface.co/Qwen/Qwen-Image-Edit" target="_blank" rel="noopener"><span>Qwen/Qwen-Image-Edit 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/edit?utm_source=huggingface&amp;utm_medium=space&amp;utm_campaign=qwen_edit_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-image" target="_blank" rel="noopener"><span>Text-to-image 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&amp;utm_medium=space&amp;utm_campaign=qwen_edit_image" target="_blank" rel="noopener">WaveSpeed AI</a>
<a href="https://wavespeed.ai/docs?utm_source=huggingface&amp;utm_medium=space&amp;utm_campaign=qwen_edit_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>