File size: 846 Bytes
77583dc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
---
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}")
```
|