Correct safety filter (#7)
Browse files- Update README.md (aebf2be7d6cdb3419c04f6d4631a4a9aa43708b5)
Co-authored-by: Apolinário from multimodal AI art <[email protected]>
README.md
CHANGED
@@ -36,6 +36,18 @@ Developers and creatives looking to build on top of `FLUX.1 Kontext [dev]` are e
|
|
36 |
|
37 |
`FLUX.1 Kontext [dev]` is also available in both [ComfyUI](https://github.com/comfyanonymous/ComfyUI) and [Diffusers](https://github.com/huggingface/diffusers).
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
### Using with diffusers 🧨
|
40 |
|
41 |
```shell
|
@@ -55,23 +67,9 @@ pipe.to("cuda")
|
|
55 |
input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
|
56 |
|
57 |
image = pipe(
|
58 |
-
image=input_image,
|
59 |
-
prompt="Add a hat to the cat",
|
60 |
-
guidance_scale=2.5
|
61 |
-
).images[0]
|
62 |
-
```
|
63 |
-
|
64 |
-
Text-to-image:
|
65 |
-
```py
|
66 |
-
import torch
|
67 |
-
from diffusers import FluxKontextPipeline
|
68 |
-
|
69 |
-
pipe = FluxKontextPipeline.from_pretrained("black-forest-labs/FLUX.1-Kontext-dev", torch_dtype=torch.bfloat16)
|
70 |
-
pipe.to("cuda")
|
71 |
-
|
72 |
-
image = pipe(
|
73 |
-
prompt="A dog eating pizza",
|
74 |
-
guidance_scale=2.5,
|
75 |
).images[0]
|
76 |
```
|
77 |
|
@@ -80,9 +78,9 @@ Flux Kontext comes with an integrity checker, which should be run after the imag
|
|
80 |
```python
|
81 |
import torch
|
82 |
import numpy as np
|
83 |
-
from flux.
|
84 |
|
85 |
-
integrity_checker =
|
86 |
image_ = np.array(image) / 255.0
|
87 |
image_ = 2 * image_ - 1
|
88 |
image_ = torch.from_numpy(image_).to("cuda", dtype=torch.float32).unsqueeze(0).permute(0, 3, 1, 2)
|
@@ -92,17 +90,6 @@ raise ValueError("Your image has been flagged. Choose another prompt/image or tr
|
|
92 |
|
93 |
For VRAM saving measures and speed ups check out the [diffusers docs](https://huggingface.co/docs/diffusers/en/index)
|
94 |
|
95 |
-
## API Endpoints
|
96 |
-
The FLUX.1 Kontext models are also available via API from the following sources
|
97 |
-
- bfl.ai: https://docs.bfl.ai/
|
98 |
-
- DataCrunch: https://datacrunch.io/flux-kontext
|
99 |
-
- fal: https://fal.ai/flux-kontext
|
100 |
-
- Replicate: https://replicate.com/blog/flux-kontext
|
101 |
-
- https://replicate.com/black-forest-labs/flux-kontext-dev
|
102 |
-
- https://replicate.com/black-forest-labs/flux-kontext-pro
|
103 |
-
- https://replicate.com/black-forest-labs/flux-kontext-max
|
104 |
-
- Runware: https://runware.ai/blog/introducing-flux1-kontext-instruction-based-image-editing-with-ai?utm_source=bfl
|
105 |
-
- TogetherAI: https://www.together.ai/models/flux-1-kontext-dev
|
106 |
|
107 |
---
|
108 |
|
|
|
36 |
|
37 |
`FLUX.1 Kontext [dev]` is also available in both [ComfyUI](https://github.com/comfyanonymous/ComfyUI) and [Diffusers](https://github.com/huggingface/diffusers).
|
38 |
|
39 |
+
## API Endpoints
|
40 |
+
The FLUX.1 Kontext models are also available via API from the following sources
|
41 |
+
- bfl.ai: https://docs.bfl.ai/
|
42 |
+
- DataCrunch: https://datacrunch.io/flux-kontext
|
43 |
+
- fal: https://fal.ai/flux-kontext
|
44 |
+
- Replicate: https://replicate.com/blog/flux-kontext
|
45 |
+
- https://replicate.com/black-forest-labs/flux-kontext-dev
|
46 |
+
- https://replicate.com/black-forest-labs/flux-kontext-pro
|
47 |
+
- https://replicate.com/black-forest-labs/flux-kontext-max
|
48 |
+
- Runware: https://runware.ai/blog/introducing-flux1-kontext-instruction-based-image-editing-with-ai?utm_source=bfl
|
49 |
+
- TogetherAI: https://www.together.ai/models/flux-1-kontext-dev
|
50 |
+
|
51 |
### Using with diffusers 🧨
|
52 |
|
53 |
```shell
|
|
|
67 |
input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png")
|
68 |
|
69 |
image = pipe(
|
70 |
+
image=input_image,
|
71 |
+
prompt="Add a hat to the cat",
|
72 |
+
guidance_scale=2.5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
).images[0]
|
74 |
```
|
75 |
|
|
|
78 |
```python
|
79 |
import torch
|
80 |
import numpy as np
|
81 |
+
from flux.content_filters import PixtralContentFilter
|
82 |
|
83 |
+
integrity_checker = PixtralContentFilter(torch.device("cuda"))
|
84 |
image_ = np.array(image) / 255.0
|
85 |
image_ = 2 * image_ - 1
|
86 |
image_ = torch.from_numpy(image_).to("cuda", dtype=torch.float32).unsqueeze(0).permute(0, 3, 1, 2)
|
|
|
90 |
|
91 |
For VRAM saving measures and speed ups check out the [diffusers docs](https://huggingface.co/docs/diffusers/en/index)
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
---
|
95 |
|