pip install git+https://github.com/huggingface/diffusers.git
pip install -U bitsandbytes
pip install -U transformers
pip install sentencepiece
pip install protobuf
import torch
from diffusers import FluxKontextPipeline
from diffusers.utils import load_image
import uuid
pipe = FluxKontextPipeline.from_pretrained("kpsss34/FLUX.1-Kontext-dev-int4", torch_dtype=torch.bfloat16)
pipe.to("cuda")
input_image = load_image("./1.jpg")
image = pipe(
image=input_image,
prompt="woman wearing dress",
guidance_scale=2.5,
num_inference_steps=30
).images[0]
filename = f"generated_image_{uuid.uuid4().hex}.png"
image.save(filename)
print(f"Saved image as {filename}")
- Downloads last month
- 743
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
๐
Ask for provider support
Model tree for kpsss34/FLUX.1-Kontext-dev-int4
Base model
black-forest-labs/FLUX.1-Kontext-dev