1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-27 17:22:53 +03:00

Kontext fixes (#11815)

fix
This commit is contained in:
Aryan
2025-06-27 04:33:44 +05:30
committed by GitHub
parent 00f95b9755
commit d7dd924ece
2 changed files with 6 additions and 4 deletions

View File

@@ -302,11 +302,11 @@ image.save("flux-kontext.png")
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:
```python
from flux.safety import PixtralIntegrity
from flux.content_filters import PixtralContentFilter
# ... pipeline invocation to generate images
integrity_checker = PixtralIntegrity(torch.device("cuda"))
integrity_checker = PixtralContentFilter(torch.device("cuda"))
image_ = np.array(image) / 255.0
image_ = 2 * image_ - 1
image_ = torch.from_numpy(image_).to("cuda", dtype=torch.float32).unsqueeze(0).permute(0, 3, 1, 2)

View File

@@ -65,8 +65,10 @@ EXAMPLE_DOC_STRING = """
... )
>>> pipe.to("cuda")
>>> image = load_image("inputs/yarn-art-pikachu.png").convert("RGB")
>>> prompt = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/yarn-art-pikachu.png"
>>> image = load_image(
... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/yarn-art-pikachu.png"
... ).convert("RGB")
>>> prompt = "Make Pikachu hold a sign that says 'Black Forest Labs is awesome', yarn art style, detailed, vibrant colors"
>>> image = pipe(
... image=image,
... prompt=prompt,