Skip to content

Commit d7dd924

Browse files
authored
Kontext fixes (#11815)
fix
1 parent 00f95b9 commit d7dd924

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

docs/source/en/api/pipelines/flux.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,11 @@ image.save("flux-kontext.png")
302302
Flux Kontext comes with an integrity safety checker, which should be run after the image generation step. To run the safety checker, install the official repository from [black-forest-labs/flux](https://github.com/black-forest-labs/flux) and add the following code:
303303

304304
```python
305-
from flux.safety import PixtralIntegrity
305+
from flux.content_filters import PixtralContentFilter
306306

307307
# ... pipeline invocation to generate images
308308

309-
integrity_checker = PixtralIntegrity(torch.device("cuda"))
309+
integrity_checker = PixtralContentFilter(torch.device("cuda"))
310310
image_ = np.array(image) / 255.0
311311
image_ = 2 * image_ - 1
312312
image_ = torch.from_numpy(image_).to("cuda", dtype=torch.float32).unsqueeze(0).permute(0, 3, 1, 2)

src/diffusers/pipelines/flux/pipeline_flux_kontext.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@
6565
... )
6666
>>> pipe.to("cuda")
6767
68-
>>> image = load_image("inputs/yarn-art-pikachu.png").convert("RGB")
69-
>>> prompt = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/yarn-art-pikachu.png"
68+
>>> image = load_image(
69+
... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/yarn-art-pikachu.png"
70+
... ).convert("RGB")
71+
>>> prompt = "Make Pikachu hold a sign that says 'Black Forest Labs is awesome', yarn art style, detailed, vibrant colors"
7072
>>> image = pipe(
7173
... image=image,
7274
... prompt=prompt,

0 commit comments

Comments
 (0)