Update README.md
Browse files
README.md
CHANGED
@@ -38,9 +38,33 @@ Please adhere to the licensing terms as described [here](https://huggingface.co/
|
|
38 |
#### How to use
|
39 |
|
40 |
```python
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
```
|
43 |
|
|
|
|
|
44 |
#### Limitations and bias
|
45 |
|
46 |
[TODO: provide examples of latent issues and potential remediations]
|
|
|
38 |
#### How to use
|
39 |
|
40 |
```python
|
41 |
+
from diffusers import FluxTransformer2DModel, FluxControlPipeline
|
42 |
+
from diffusers.utils import load_image
|
43 |
+
import torch
|
44 |
+
|
45 |
+
path = "sayakpaul/cartoon-control-lr_1e-4-wd_1e-4-gs_10.0-cd_0.1"
|
46 |
+
transformer = FluxTransformer2DModel.from_pretrained(path, torch_dtype=torch.bfloat16)
|
47 |
+
pipe = FluxControlPipeline.from_pretrained(
|
48 |
+
"black-forest-labs/FLUX.1-dev", transformer=transformer, torch_dtype=torch.bfloat16
|
49 |
+
).to("cuda")
|
50 |
+
|
51 |
+
prompt = "Generate a cartoonized version of the image"
|
52 |
+
url = "https://huggingface.co/sayakpaul/cartoon-control-lr_1e-4-wd_1e-4-gs_10.0-cd_0.1/resolve/main/taj.jpg"
|
53 |
+
|
54 |
+
image = load_image(img).resize((1024, 1024))
|
55 |
+
gen_image = pipe(
|
56 |
+
prompt=prompt,
|
57 |
+
control_image=image,
|
58 |
+
guidance_scale=10.,
|
59 |
+
num_inference_steps=50,
|
60 |
+
generator=torch.manual_seed(0),
|
61 |
+
max_sequence_length=512,
|
62 |
+
).images[0]
|
63 |
+
gen_image.save("output.png")
|
64 |
```
|
65 |
|
66 |
+
Refer to the Flux Control docs [here](https://huggingface.co/docs/diffusers/main/en/api/pipelines/flux).
|
67 |
+
|
68 |
#### Limitations and bias
|
69 |
|
70 |
[TODO: provide examples of latent issues and potential remediations]
|