Peut tu changer sa position en mode miniature youtube fortnite
Browse files
README.md
CHANGED
|
@@ -1,144 +1,87 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
language:
|
| 4 |
-
- en
|
| 5 |
-
- zh
|
| 6 |
-
library_name: diffusers
|
| 7 |
-
pipeline_tag: image-to-image
|
| 8 |
-
---
|
| 9 |
-
<p align="center">
|
| 10 |
-
<img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/qwen_image_edit_logo.png" width="400"/>
|
| 11 |
-
<p>
|
| 12 |
-
<p align="center">
|
| 13 |
-
💜 <a href="https://chat.qwen.ai/"><b>Qwen Chat</b></a>   |   🤗 <a href="https://huggingface.co/Qwen/Qwen-Image-Edit-2511">Hugging Face</a>   |   🤖 <a href="https://modelscope.cn/models/Qwen/Qwen-Image-Edit-2511">ModelScope</a>   |    📑 <a href="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-Image/Qwen_Image.pdf">Tech Report</a>    |    📑 <a href="https://qwenlm.github.io/blog/qwen-image-edit-2511/">Blog</a>   
|
| 14 |
-
<br>
|
| 15 |
-
🖥️ <a href="https://huggingface.co/spaces/Qwen/Qwen-Image-Edit-2511">Demo</a>   |   💬 <a href="https://github.com/QwenLM/Qwen-Image/blob/main/assets/wechat.png">WeChat (微信)</a>   |   🫨 <a href="https://discord.gg/CV4E9rpNSD">Discord</a>  |    <a href="https://github.com/QwenLM/Qwen-Image">Github</a>  
|
| 16 |
-
</p>
|
| 17 |
-
|
| 18 |
-
<p align="center">
|
| 19 |
-
<img src="https://qianwen-res.oss-accelerate-overseas.aliyuncs.com/Qwen-Image/edit2511/edit2511big.JPG#center" width="1600"/>
|
| 20 |
-
<p>
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
# Introduction
|
| 24 |
-
|
| 25 |
-
We are excited to introduce Qwen-Image-Edit-2511, an enhanced version over Qwen-Image-Edit-2509, featuring multiple improvements—including notably better consistency. To try out the latest model, please visit [Qwen Chat](https://chat.qwen.ai/?inputFeature=image_edit) and select the Image Editing feature.
|
| 26 |
-
|
| 27 |
-
Key enhancements in Qwen-Image-Edit-2511 include: mitigate image drift, improved character consistency,integrated LoRA capabilities, enhanced industrial design generation, and strengthened geometric reasoning ability.
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
## Quick Start
|
| 31 |
-
|
| 32 |
-
Install the latest version of diffusers
|
| 33 |
-
```
|
| 34 |
-
pip install git+https://github.com/huggingface/diffusers
|
| 35 |
-
```
|
| 36 |
-
|
| 37 |
-
The following contains a code snippet illustrating how to use `Qwen-Image-Edit-2511`:
|
| 38 |
-
|
| 39 |
-
```python
|
| 40 |
-
import os
|
| 41 |
import torch
|
|
|
|
|
|
|
|
|
|
| 42 |
from PIL import Image
|
| 43 |
-
from diffusers import QwenImageEditPlusPipeline
|
| 44 |
-
|
| 45 |
-
pipeline = QwenImageEditPlusPipeline.from_pretrained("Qwen/Qwen-Image-Edit-2511", torch_dtype=torch.bfloat16)
|
| 46 |
-
print("pipeline loaded")
|
| 47 |
-
|
| 48 |
-
pipeline.to('cuda')
|
| 49 |
-
pipeline.set_progress_bar_config(disable=None)
|
| 50 |
-
image1 = Image.open("input1.png")
|
| 51 |
-
image2 = Image.open("input2.png")
|
| 52 |
-
prompt = "The magician bear is on the left, the alchemist bear is on the right, facing each other in the central park square."
|
| 53 |
-
inputs = {
|
| 54 |
-
"image": [image1, image2],
|
| 55 |
-
"prompt": prompt,
|
| 56 |
-
"generator": torch.manual_seed(0),
|
| 57 |
-
"true_cfg_scale": 4.0,
|
| 58 |
-
"negative_prompt": " ",
|
| 59 |
-
"num_inference_steps": 40,
|
| 60 |
-
"guidance_scale": 1.0,
|
| 61 |
-
"num_images_per_prompt": 1,
|
| 62 |
-
}
|
| 63 |
-
with torch.inference_mode():
|
| 64 |
-
output = pipeline(**inputs)
|
| 65 |
-
output_image = output.images[0]
|
| 66 |
-
output_image.save("output_image_edit_2511.png")
|
| 67 |
-
print("image saved at", os.path.abspath("output_image_edit_2511.png"))
|
| 68 |
-
|
| 69 |
-
```
|
| 70 |
-
|
| 71 |
-
## Showcase
|
| 72 |
-
|
| 73 |
-
**Qwen-Image-Edit-2511 Enhances Character Consistency**
|
| 74 |
-
In Qwen-Image-Edit-2511, character consistency has been significantly improved. The model can perform imaginative edits based on an input portrait while preserving the identity and visual characteristics of the subject.
|
| 75 |
-
|
| 76 |
-

|
| 77 |
-

|
| 78 |
-

|
| 79 |
-

|
| 80 |
-
|
| 81 |
-
**Improved Multi-Person Consistency**
|
| 82 |
-
While Qwen-Image-Edit-2509 already improved consistency for single-subject editing, Qwen-Image-Edit-2511 further enhances consistency in multi-person group photos—enabling high-fidelity fusion of two separate person images into a coherent group shot:
|
| 83 |
-

|
| 84 |
-

|
| 85 |
-
|
| 86 |
-
**Built-in Support for Community-Created LoRAs**
|
| 87 |
-
Since Qwen-Image-Edit’s release, the community has developed many creative and high-quality LoRAs—greatly expanding its expressive potential. Qwen-Image-Edit-2511 integrates selected popular LoRAs directly into the base model, unlocking their effects without extra tuning.
|
| 88 |
-
|
| 89 |
-
For example, Lighting Enhancement LoRA
|
| 90 |
-
Realistic lighting control is now achievable out-of-the-box:
|
| 91 |
-

|
| 92 |
-
|
| 93 |
-

|
| 94 |
-
|
| 95 |
-
Another example, generating new viewpoints can now be done directly with the base model:
|
| 96 |
-
|
| 97 |
-

|
| 98 |
-
|
| 99 |
-

|
| 100 |
-
|
| 101 |
-
**Industrial Design Applications**
|
| 102 |
-
|
| 103 |
-
We’ve paid special attention to practical engineering scenarios—for instance, batch industrial product design:
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-

|
| 107 |
-
|
| 108 |
-

|
| 109 |
-
|
| 110 |
-
…and material replacement for industrial components:
|
| 111 |
-

|
| 112 |
-
|
| 113 |
-

|
| 114 |
-
|
| 115 |
-
**Enhanced Geometric Reasoning**
|
| 116 |
-
Qwen-Image-Edit-2511 introduces stronger geometric reasoning capability—e.g., directly generating auxiliary construction lines for design or annotation purposes:
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-

|
| 120 |
-
|
| 121 |
-

|
| 122 |
-
|
| 123 |
-
That wraps up the major updates in Qwen-Image-Edit-2511.
|
| 124 |
-
Enjoy exploring the new capabilities! 🎉
|
| 125 |
-
|
| 126 |
-
## License Agreement
|
| 127 |
-
|
| 128 |
-
Qwen-Image is licensed under Apache 2.0.
|
| 129 |
-
|
| 130 |
-
## Citation
|
| 131 |
-
|
| 132 |
-
We kindly encourage citation of our work if you find it useful.
|
| 133 |
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import torch
|
| 2 |
+
from diffusers import AutoPipelineForImage2Image
|
| 3 |
+
from diffusers.utils import load_image
|
| 4 |
+
import gradio as gr
|
| 5 |
from PIL import Image
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
|
| 7 |
+
# 1. Configuration du Modèle (On utilise SDXL Refiner ou Base pour la haute qualité)
|
| 8 |
+
# Si tu as une carte graphique (GPU), cela prendra quelques secondes. Sur CPU, c'est lent.
|
| 9 |
+
model_id = "stabilityai/stable-diffusion-xl-refiner-1.0"
|
| 10 |
+
|
| 11 |
+
# Vérification du matériel (GPU vs CPU)
|
| 12 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 13 |
+
dtype = torch.float16 if device == "cuda" else torch.float32
|
| 14 |
+
|
| 15 |
+
print(f"Chargement du modèle sur {device}...")
|
| 16 |
+
|
| 17 |
+
# Chargement du pipeline Image-to-Image
|
| 18 |
+
pipe = AutoPipelineForImage2Image.from_pretrained(
|
| 19 |
+
model_id,
|
| 20 |
+
torch_dtype=dtype,
|
| 21 |
+
use_safetensors=True
|
| 22 |
+
)
|
| 23 |
+
pipe.to(device)
|
| 24 |
+
|
| 25 |
+
# 2. La fonction de transformation
|
| 26 |
+
def modifier_skin(image_source, prompt_utilisateur, strength_value):
|
| 27 |
+
# Prompt de base pour forcer le style Fortnite Miniature
|
| 28 |
+
base_prompt = "Fortnite style 3D render, unreal engine 5, 8k, highly detailed, glossy skin, vibrant colors, victory royale atmosphere, volumetric lighting, ray tracing"
|
| 29 |
+
|
| 30 |
+
# Prompt négatif pour éviter les déformations
|
| 31 |
+
negative_prompt = "ugly, blurry, low quality, pixelated, bad anatomy, deformed hands, watermark, text"
|
| 32 |
+
|
| 33 |
+
final_prompt = f"{prompt_utilisateur}, {base_prompt}"
|
| 34 |
+
|
| 35 |
+
# Redimensionner l'image pour optimiser la vitesse (SDXL aime le 1024x1024 environ)
|
| 36 |
+
image_source = image_source.convert("RGB")
|
| 37 |
+
image_source.thumbnail((1024, 1024))
|
| 38 |
+
|
| 39 |
+
# Génération
|
| 40 |
+
# 'strength' définit à quel point on modifie l'image originale (0.1 = peu, 1.0 = total)
|
| 41 |
+
image_generee = pipe(
|
| 42 |
+
prompt=final_prompt,
|
| 43 |
+
negative_prompt=negative_prompt,
|
| 44 |
+
image=image_source,
|
| 45 |
+
strength=strength_value,
|
| 46 |
+
guidance_scale=7.5,
|
| 47 |
+
num_inference_steps=30
|
| 48 |
+
).images[0]
|
| 49 |
+
|
| 50 |
+
return image_generee
|
| 51 |
+
|
| 52 |
+
# 3. Interface Utilisateur (Gradio)
|
| 53 |
+
custom_css = """
|
| 54 |
+
#col-container {max_width: 800px; margin-left: auto; margin-right: auto;}
|
| 55 |
+
"""
|
| 56 |
+
|
| 57 |
+
with gr.Blocks(css=custom_css) as demo:
|
| 58 |
+
with gr.Column(elem_id="col-container"):
|
| 59 |
+
gr.Markdown("# 🎮 Générateur de Miniatures Fortnite (Style Render 3D)")
|
| 60 |
+
gr.Markdown("Transforme une capture d'écran basique en rendu 3D haute qualité pour YouTube.")
|
| 61 |
+
|
| 62 |
+
with gr.Row():
|
| 63 |
+
with gr.Column():
|
| 64 |
+
input_img = gr.Image(label="Ton image de base (Skin)", type="pil")
|
| 65 |
+
prompt_input = gr.Textbox(
|
| 66 |
+
label="Description du Skin (Anglais recommandé)",
|
| 67 |
+
value="female character, red hair, black mask, holding a golden trophy",
|
| 68 |
+
placeholder="Ex: Ramirez skin holding a scar..."
|
| 69 |
+
)
|
| 70 |
+
strength_slider = gr.Slider(
|
| 71 |
+
label="Force de la modification (0.3 = Retouche légère / 0.7 = Gros changement)",
|
| 72 |
+
minimum=0.1, maximum=1.0, value=0.45, step=0.05
|
| 73 |
+
)
|
| 74 |
+
run_btn = gr.Button("Générer le Render 🔥", variant="primary")
|
| 75 |
+
|
| 76 |
+
with gr.Column():
|
| 77 |
+
output_img = gr.Image(label="Résultat Render 3D")
|
| 78 |
+
|
| 79 |
+
run_btn.click(
|
| 80 |
+
fn=modifier_skin,
|
| 81 |
+
inputs=[input_img, prompt_input, strength_slider],
|
| 82 |
+
outputs=[output_img]
|
| 83 |
+
)
|
| 84 |
+
|
| 85 |
+
# Lancement de l'app
|
| 86 |
+
if __name__ == "__main__":
|
| 87 |
+
demo.launch()
|