YiYiXu's picture
Update README.md
c37869d verified
|
raw
history blame
1.39 kB
metadata
library_name: diffusers

use ideogram-api to generate character using one input image

Get your Ideogram API token from here

Set it as the IDEOGRAM_API_KEY environment variable:

from diffusers import ModularPipeline
from diffusers.utils import load_image

character_pipe = ModularPipeline.from_pretrained("diffusers-internal-dev/ideogram-character-generator", trust_remote_code=True)
print(character_pipe.doc)

image = character_pipe(
    prompt=(
        "medium shot (waist-up) of an Asian woman, full upper body clearly visible, "
        "wearing a T-shirt with the text 'Modular Diffusers' legible on the chest, natural lighting, "
        "professional photography style"
    ),
    character_image=load_image("yiyi_3.jpg"),
    output="image"
)

image.save("yiyi_character.png")

use with Flux Kontext

from diffusers import FluxKontextPipeline
import torch

pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16)
pipe.to("cuda")


image = pipe(
  image=image,
  prompt='''standing in front of a coffee shop entrace with text "Huggingface". Do not change the character.''',
  guidance_scale=1.5
).images[0]

image/png