clementchadebec commited on
Commit
c7be9b2
1 Parent(s): ceaf8d3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +83 -0
README.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - black-forest-labs/FLUX.1-dev
4
+ library_name: diffusers
5
+ license_name: flux-1-dev-non-commercial-license
6
+ license_link: https://huggingface.co/black-forest-labs/FLUX.1-dev/blob/main/LICENSE.md
7
+ pipeline_tag: image-to-image
8
+ tags:
9
+ - ControlNet
10
+ ---
11
+ # ⚡ Flux.1-dev: Depth ControlNet ⚡
12
+
13
+ This is [Flux.1-dev](https://huggingface.co/black-forest-labs/FLUX.1-dev) ControlNet for Depth map developped by Jasper research team.
14
+
15
+ <p align="center">
16
+ <img style="width:700px;" src="examples/showcase.jpg">
17
+ </p>
18
+
19
+ # How to use
20
+ This model can be used directly with the `diffusers` library
21
+
22
+ ```python
23
+ import torch
24
+ from diffusers.utils import load_image
25
+ from diffusers import FluxControlNetModel
26
+ from diffusers.pipelines import FluxControlNetPipeline
27
+
28
+ # Load pipeline
29
+ controlnet = FluxControlNetModel.from_pretrained(
30
+ "jasperai/Flux.1-dev-Controlnet-Depth",
31
+ torch_dtype=torch.bfloat16
32
+ )
33
+ pipe = FluxControlNetPipeline.from_pretrained(
34
+ "black-forest-labs/FLUX.1-dev",
35
+ controlnet=controlnet,
36
+ torch_dtype=torch.bfloat16
37
+ )
38
+
39
+
40
+ # Load a control image
41
+ control_image = load_image(
42
+ "https://huggingface.co/jasperai/Flux.1-dev-Controlnet-Depth/resolve/main/examples/depth.jpg"
43
+ )
44
+
45
+ prompt = "a statue of a gnome in a field of purple tulips"
46
+
47
+ image = pipe(
48
+ prompt,
49
+ control_image=control_image,
50
+ controlnet_conditioning_scale=0.6,
51
+ num_inference_steps=28,
52
+ guidance_scale=3.5,
53
+ height=control_image.size[1],
54
+ width=control_image.size[0]
55
+ ).images[0]
56
+ image
57
+ ```
58
+
59
+ <p align="center">
60
+ <img style="width:500px;" src="examples/output.jpg">
61
+ </p>
62
+
63
+ 💡 Note: You can compute the conditioning map using for instance the `MidasDetector` from the `controlnet_aux` library
64
+
65
+ ```python
66
+ from controlnet_aux import MidasDetector
67
+ from diffusers.utils import load_image
68
+
69
+ midas = MidasDetector.from_pretrained("lllyasviel/Annotators")
70
+
71
+ # Load an image
72
+ im = load_image(
73
+ "https://huggingface.co/jasperai/jasperai/Flux.1-dev-Controlnet-Depth/resolve/main/examples/output.jpg"
74
+ )
75
+
76
+ surface = midas(im)
77
+ ```
78
+
79
+ # Training
80
+ This model was trained with depth maps computed with [Clipdrop's depth estimator model](https://clipdrop.co/apis/docs/portrait-depth-estimation) as well as open-souce depth estimation models such as Midas or Leres.
81
+
82
+ # Licence
83
+ The licence under the Flux.1-dev model applies to this model.