Instructions to use jasperai/Flux.1-dev-Controlnet-Depth with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use jasperai/Flux.1-dev-Controlnet-Depth with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("jasperai/Flux.1-dev-Controlnet-Depth", torch_dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ⚡ Flux.1-dev: Depth ControlNet ⚡
|
| 2 |
+
|
| 3 |
+
A controlNet for depth map developped by Jasper research team.
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
# How to use
|
| 8 |
+
This model can be used directly with the `diffusers` library
|
| 9 |
+
|
| 10 |
+
```python
|
| 11 |
+
import torch
|
| 12 |
+
from diffusers.utils import load_image
|
| 13 |
+
from diffusers import FluxControlNetModel
|
| 14 |
+
from diffusers.pipelines import FluxControlNetPipeline
|
| 15 |
+
|
| 16 |
+
# Load pipeline
|
| 17 |
+
controlnet = FluxControlNetModel.from_pretrained(
|
| 18 |
+
"jasperai/Flux.1-dev-Controlnet-Depth",
|
| 19 |
+
torch_dtype=torch.bfloat16
|
| 20 |
+
)
|
| 21 |
+
pipe = FluxControlNetPipeline.from_pretrained(
|
| 22 |
+
"black-forest-labs/FLUX.1-dev",
|
| 23 |
+
controlnet=controlnet,
|
| 24 |
+
torch_dtype=torch.bfloat16
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
# Load a control image
|
| 28 |
+
control_image = load_image("https://huggingface.co/InstantX/FLUX.1-dev-Controlnet-Canny/resolve/main/canny.jpg")
|
| 29 |
+
|
| 30 |
+
image = pipe(
|
| 31 |
+
prompt,
|
| 32 |
+
control_image=control_image,
|
| 33 |
+
controlnet_conditioning_scale=0.6,
|
| 34 |
+
num_inference_steps=28,
|
| 35 |
+
guidance_scale=3.5,
|
| 36 |
+
).images[0]
|
| 37 |
+
image.save("image.jpg")
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
<p align="center">
|
| 41 |
+
<img style="width:700px;" src="assets/flash_pixart.jpg">
|
| 42 |
+
</p>
|
| 43 |
+
|
| 44 |
+
# Licence
|
| 45 |
+
The licence under the Flux.1-dev model applies to this model.
|