Files changed (1) hide show
  1. README.md +64 -0
README.md CHANGED
@@ -135,3 +135,67 @@ We kindly encourage citation of our work if you find it useful.
135
 
136
  ## Join Us
137
  If you're passionate about fundamental research, we're hiring full-time employees (FTEs) and research interns. Don't wait — reach out to us at fulai.hr@alibaba-inc.com
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
 
136
  ## Join Us
137
  If you're passionate about fundamental research, we're hiring full-time employees (FTEs) and research interns. Don't wait — reach out to us at fulai.hr@alibaba-inc.com
138
+
139
+
140
+
141
+ ## 中文
142
+
143
+ ---license: apache-2.0
144
+ language:
145
+ - en
146
+ - zh
147
+ library_name: diffusers
148
+ pipeline_tag: image-to-image
149
+ ---
150
+ <p align="center"> <img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_edit_logo.png" width="400"/><p>
151
+ <p align="center"> 💜 <a href="https://chat.qwen.ai/"><b>通义千问聊天</b></a>&nbsp&nbsp | &nbsp&nbsp🤗 <a href="https://huggingface.co/Qwen/Qwen-Image-Edit">Hugging Face</a>&nbsp&nbsp | &nbsp&nbsp🤖 <a href="https://modelscope.cn/models/Qwen/Qwen-Image-Edit">魔搭(ModelScope)</a>&nbsp&nbsp | &nbsp&nbsp 📑 <a href="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/Qwen_Image.pdf">技术报告</a>&nbsp&nbsp | &nbsp&nbsp 📑 <a href="https://qwenlm.github.io/blog/qwen-image-edit/">博客</a> &nbsp&nbsp <br>
152
+ 🖥️ <a href="https://huggingface.co/spaces/Qwen/Qwen-Image-Edit">在线演示</a>&nbsp&nbsp | &nbsp&nbsp💬 <a href="https://github.com/QwenLM/Qwen-Image/blob/main/assets/wechat.png">微信</a>&nbsp&nbsp | &nbsp&nbsp🫨 <a href="https://discord.gg/CV4E9rpNSD">Discord</a>&nbsp&nbsp| &nbsp&nbsp <a href="https://github.com/QwenLM/Qwen-Image">Github</a>&nbsp&nbsp</p>
153
+ <p align="center"> <img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/edit_homepage.jpg" width="1600"/><p>
154
+
155
+ # 简介
156
+
157
+ 我们很高兴推出 Qwen-Image-Edit,这是 Qwen-Image 的图像编辑版本。该模型基于我们的 200 亿参数 Qwen-Image 模型构建,成功地将 Qwen-Image 独特的文本渲染能力拓展至图像编辑任务,实现了精准的文本编辑。此外,Qwen-Image-Edit 同时将输入图像送入 Qwen2.5-VL(用于视觉语义控制)和 VAE 编码器(用于视觉外观控制),从而兼具语义编辑和外观编辑的能力。
158
+
159
+ 要体验最新模型,请访问 [通义千问聊天](https://qwen.ai) 并选择“图像编辑”功能。
160
+
161
+ **主要特性:**
162
+
163
+ * **语义与外观编辑**:Qwen-Image-Edit 支持低层次的视觉外观编辑(例如添加、删除或修改元素,要求图像其他区域完全不变)和高层次的视觉语义编辑(例如 IP 形象创作、物体旋转、风格迁移等,允许整体像素发生变化,同时保持语义一致性)。
164
+ * **精准文本编辑**:Qwen-Image-Edit 支持中英双语文本编辑,能够直接在图像中添加、删除和修改文本,同时保留原始字体、大小和样式。
165
+ * **卓越的基准性能**:在多个公开基准上的评估表明,Qwen-Image-Edit 在图像编辑任务上达到了业界领先(SOTA)水平,使其成为强大的图像编辑基础模型。
166
+
167
+ ## 快速上手
168
+
169
+ 安装最新版本的 diffusers:
170
+ ```pip install git+https://github.com/huggingface/diffusers```
171
+
172
+ 以下代码片段展示了如何使用该模型根据文本提示生成图像:
173
+
174
+ ```python
175
+ import os
176
+ from PIL import Image
177
+ import torch
178
+ from diffusers import QwenImageEditPipeline
179
+
180
+ pipeline = QwenImageEditPipeline.from_pretrained("Qwen/Qwen-Image-Edit")
181
+ print("pipeline loaded")
182
+ pipeline.to(torch.bfloat16)
183
+ pipeline.to("cuda")
184
+ pipeline.set_progress_bar_config(disable=None)
185
+
186
+ image = Image.open("./input.png").convert("RGB")
187
+ prompt = "将兔子的颜色改为紫色,并带有闪光灯背景。"
188
+ inputs = {
189
+ "image": image,
190
+ "prompt": prompt,
191
+ "generator": torch.manual_seed(0),
192
+ "true_cfg_scale": 4.0,
193
+ "negative_prompt": " ",
194
+ "num_inference_steps": 50,
195
+ }
196
+
197
+ with torch.inference_mode():
198
+ output = pipeline(**inputs)
199
+ output_image = output.images[0]
200
+ output_image.save("output_image_edit.png")
201
+ print("image saved at", os.path.abspath("output_image_edit.png"))