Skip to content

Commit d242d02

Browse files
committed
add example
1 parent 51fcdf8 commit d242d02

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/diffusers/pipelines/flux/pipeline_flux_kontext.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,27 @@
5656
EXAMPLE_DOC_STRING = """
5757
Examples:
5858
```py
59-
# TODO
59+
>>> import torch
60+
>>> from diffusers import FluxKontextPipeline
61+
>>> from diffusers.utils import load_image
62+
63+
>>> pipe = FluxKontextPipeline.from_pretrained(
64+
... "black-forest-labs/FLUX.1-kontext", transformer=transformer, torch_dtype=torch.bfloat16
65+
... )
66+
>>> pipe.to("cuda")
67+
68+
>>> image = load_image("inputs/yarn-art-pikachu.png").convert("RGB")
69+
>>> prompt = "Make Pikachu hold a sign that says 'Hugging Face is awesome', yarn art style, detailed, vibrant colors"
70+
>>> image = pipe(
71+
... image=image,
72+
... prompt=prompt,
73+
... guidance_scale=2.5,
74+
... generator=torch.Generator().manual_seed(42),
75+
... ).images[0]
76+
>>> image.save("output.png")
6077
```
6178
"""
6279

63-
6480
PREFERRED_KONTEXT_RESOLUTIONS = [
6581
(672, 1568),
6682
(688, 1504),

0 commit comments

Comments
 (0)