1
0
mirror of https://github.com/huggingface/diffusers.git synced 2026-01-29 07:22:12 +03:00

add example

This commit is contained in:
Aryan
2025-05-28 05:46:40 +02:00
parent 51fcdf88aa
commit d242d02e5b

View File

@@ -56,11 +56,27 @@ logger = logging.get_logger(__name__) # pylint: disable=invalid-name
EXAMPLE_DOC_STRING = """
Examples:
```py
# TODO
>>> import torch
>>> from diffusers import FluxKontextPipeline
>>> from diffusers.utils import load_image
>>> pipe = FluxKontextPipeline.from_pretrained(
... "black-forest-labs/FLUX.1-kontext", transformer=transformer, torch_dtype=torch.bfloat16
... )
>>> pipe.to("cuda")
>>> image = load_image("inputs/yarn-art-pikachu.png").convert("RGB")
>>> prompt = "Make Pikachu hold a sign that says 'Hugging Face is awesome', yarn art style, detailed, vibrant colors"
>>> image = pipe(
... image=image,
... prompt=prompt,
... guidance_scale=2.5,
... generator=torch.Generator().manual_seed(42),
... ).images[0]
>>> image.save("output.png")
```
"""
PREFERRED_KONTEXT_RESOLUTIONS = [
(672, 1568),
(688, 1504),