|
--- |
|
base_model: |
|
- black-forest-labs/FLUX.1-Fill-dev |
|
pipeline_tag: image-to-image |
|
tags: |
|
- text-generation-inference |
|
--- |
|
|
|
pip install -U diffusers |
|
|
|
```python |
|
import torch |
|
from diffusers import FluxFillPipeline |
|
from diffusers.utils import load_image |
|
|
|
image = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup.png") |
|
mask = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup_mask.png") |
|
|
|
pipe = FluxFillPipeline.from_pretrained("kpsss34/FLUX.1-Fill-int4", torch_dtype=torch.bfloat16).to("cuda") |
|
image = pipe( |
|
prompt="a white paper cup", |
|
image=image, |
|
mask_image=mask, |
|
height=512, |
|
width=512, |
|
guidance_scale=4.0, |
|
num_inference_steps=50, |
|
max_sequence_length=512, |
|
generator=torch.Generator("cpu").manual_seed(0) |
|
).images[0] |
|
image.save(f"flux-fill-dev.png") |
|
``` |