There You Go
#7
by
ameerazam08
- opened
import torch
from diffusers import FluxInpaintPipeline
from diffusers.utils import load_image
pipe = FluxInpaintPipeline.from_pretrained("FLUX.1-Krea-dev", torch_dtype=torch.bfloat16)
pipe.to("cuda")
prompt = "Face of a yellow cat, high resolution, sitting on a park bench"
img_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
mask_url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png"
source = load_image(img_url)
mask = load_image(mask_url)
image = pipe(prompt=prompt, image=source, mask_image=mask).images[0]
image.save("flux_inpainting.png")
import torch
from diffusers import FluxImg2ImgPipeline
from diffusers.utils import load_image
device = "cuda"
pipe = FluxImg2ImgPipeline.from_pretrained("FLUX.1-Krea-dev", torch_dtype=torch.bfloat16)
pipe = pipe.to(device)
url = "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png"
init_image_og = load_image(url)
init_image = init_image_og.resize((1024, 1024))
prompt = "cat sitting on a bench"
images = pipe(
prompt=prompt, image=init_image, num_inference_steps=20, strength=0.95, guidance_scale=7.5).images[0]
images = images.resize(init_image_og.size)
# images.save("flux_img2img.png")
import torch
from diffusers import FluxPipeline
pipe = FluxPipeline.from_pretrained("FLUX.1-Krea-dev", torch_dtype=torch.bfloat16)
pipe.to("cuda")
prompt = """
A cute, high-resolution sticker-style illustration of a happy dog sitting with its tongue out, big round eyes, floppy ears, soft tan and white fur, pastel color palette, outlined with a clean white border, cartoonish yet slightly textured, transparent background, perfect for digital sticker use, Flux render style
"""
# Depending on the variant being used, the pipeline call will slightly vary.
# Refer to the pipeline documentation for more details.
num_inference_steps = 30
image = pipe(prompt,
num_inference_steps=steps,
generator=torch.Generator().manual_seed(124),
guidance_scale=guidance_scale
).images[0]
image.save(f"flux_text_to_image.png")