camenduru's picture
thanks to kpsss34 ❤
77583dc verified
---
base_model:
- black-forest-labs/FLUX.1-Kontext-dev
pipeline_tag: image-to-image
library_name: diffusers
tags:
- text-generation-inference
---
- pip install git+https://github.com/huggingface/diffusers.git
- pip install -U bitsandbytes
- pip install -U transformers
- pip install sentencepiece
- pip install protobuf
```py
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}")
```