Update README.md
Browse files
README.md
CHANGED
|
@@ -49,14 +49,55 @@ pipe_t2i.enable_lora()
|
|
| 49 |
out = pipe_t2i(prompt=prompt, guidance_scale=3.5, height=768, width=512, num_inference_steps=50).images[0]
|
| 50 |
out.save("t2i_color_palette.png")
|
| 51 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
-
# Inference
|
| 58 |
|
|
|
|
|
|
|
| 59 |
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
# Training
|
| 62 |
|
|
|
|
| 49 |
out = pipe_t2i(prompt=prompt, guidance_scale=3.5, height=768, width=512, num_inference_steps=50).images[0]
|
| 50 |
out.save("t2i_color_palette.png")
|
| 51 |
```
|
| 52 |
+
## Conditional Generation
|
| 53 |
+
<table>
|
| 54 |
+
<tr>
|
| 55 |
+
<td><img src="./pictures/blue.png" style="width:100%;"></td>
|
| 56 |
+
<td><img src="./pictures/red.png" style="width:100%;"></td>
|
| 57 |
+
<td><img src="./pictures/yellow.png" style="width:100%;"></td>
|
| 58 |
+
</tr>
|
| 59 |
+
<tr>
|
| 60 |
+
<td><img src="./pictures/inpainting_bottle_blue.png" style="width:100%;"></td>
|
| 61 |
+
<td><img src="./pictures/inpainting_bottle_red.png" style="width:100%;"></td>
|
| 62 |
+
<td><img src="./pictures/inpainting_bottle_yellow.png" style="width:100%;"></td>
|
| 63 |
+
</tr>
|
| 64 |
+
<tr>
|
| 65 |
+
<td><img src="./pictures/inpainting_bag_blue.png" style="width:100%;"></td>
|
| 66 |
+
<td><img src="./pictures/inpainting_bag_red.png" style="width:100%;"></td>
|
| 67 |
+
<td><img src="./pictures/inpainting_bag_yellow.png" style="width:100%;"></td>
|
| 68 |
+
</tr>
|
| 69 |
+
<tr>
|
| 70 |
+
<td><img src="./pictures/inpainting_backpack_blue.png" style="width:100%;"></td>
|
| 71 |
+
<td><img src="./pictures/inpainting_backpack_red.png" style="width:100%;"></td>
|
| 72 |
+
<td><img src="./pictures/inpainting_backpack_yellow.png" style="width:100%;"></td>
|
| 73 |
+
</tr>
|
| 74 |
+
</table>
|
| 75 |
|
| 76 |
+
```python
|
| 77 |
+
import torch
|
| 78 |
+
import numpy as np
|
| 79 |
+
from PIL import Image
|
| 80 |
+
from diffusers.utils import load_image
|
| 81 |
+
from diffusers import FluxInpaintPipeline
|
| 82 |
|
| 83 |
+
pipe_inpainting = FluxInpaintPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16).to("cuda")
|
| 84 |
+
pipe_inpainting.load_lora_weights("./color_palette_lora.safetensors")
|
| 85 |
+
mask = load_image("./mask.jpg").resize(size=(768, 512))
|
| 86 |
+
color_palette = load_image("./blue.png")
|
| 87 |
+
input_image = Image.new('RGB', (768, 512))
|
| 88 |
+
input_image.paste(color_palette.resize(size=(256, 512)), (0, 256))
|
| 89 |
+
input_image.paste(color_palette.resize(size=(512, 512)), (512, 256))
|
| 90 |
+
out = pipe_inpainting(prompt=prompt, image=color_palette, mask_image=mask, guidance_scale=3.5, height=768, width=512, num_inference_steps=50, max_sequence_length=256, strength=1).images[0]
|
| 91 |
+
out.save("conda_color_palette.png")
|
| 92 |
+
```
|
| 93 |
|
|
|
|
| 94 |
|
| 95 |
+
# Model description
|
| 96 |
+
The model follows the idea of IC-Lora, image splicing is used for training and inferencing. The IC-Lora prompt template is like this👇
|
| 97 |
|
| 98 |
+
```
|
| 99 |
+
[COLOR_PALETTE] This two-part image showcases the transformation from a color palette to a image. [LEFT] a color palette with eight 5 different colors. [RIGHT] xxxxx
|
| 100 |
+
```
|
| 101 |
|
| 102 |
# Training
|
| 103 |
|