Upload README.md with huggingface_hub
Browse files
README.md
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
license_name: tencent-hunyuan-community
|
4 |
+
license_link: https://huggingface.co/Tencent-Hunyuan/HunyuanDiT/blob/main/LICENSE.txt
|
5 |
+
---
|
6 |
+
|
7 |
+
```py
|
8 |
+
from diffusers import HunyuanDiT2DControlNetModel, HunyuanDiTControlNetPipeline
|
9 |
+
import torch
|
10 |
+
|
11 |
+
|
12 |
+
controlnet = HunyuanDiT2DControlNetModel.from_pretrained("Tencent-Hunyuan/HunyuanDiT-v1.2-ControlNet-Diffusers-Distilled-Pose", torch_dtype=torch.float16)
|
13 |
+
|
14 |
+
pipe = HunyuanDiTControlNetPipeline.from_pretrained("Tencent-Hunyuan/HunyuanDiT-v1.2-Diffusers-Distilled", controlnet=controlnet, torch_dtype=torch.float16)
|
15 |
+
pipe.to("cuda")
|
16 |
+
|
17 |
+
from diffusers.utils import load_image
|
18 |
+
cond_image = load_image('https://huggingface.co/Tencent-Hunyuan/HunyuanDiT-v1.2-ControlNet-Diffusers-Distilled-Pose/resolve/main/pose.jpg?download=true')
|
19 |
+
|
20 |
+
## You may also use English prompt as HunyuanDiT supports both English and Chinese
|
21 |
+
prompt="在白天的森林中,一位穿着绿色上衣的亚洲女性站在大象旁边。照片采用了中景、平视和居中构图的方式,呈现出写实的效果。这张照片蕴含了人物摄影文化,并展现了宁静的氛围"
|
22 |
+
#prompt="In the daytime forest, an Asian woman wearing a green shirt stands beside an elephant. The photo uses a medium shot, eye-level, and centered composition to create a realistic effect. This picture embodies the character photography culture and conveys a serene atmosphere."
|
23 |
+
|
24 |
+
torch.manual_seed(42)
|
25 |
+
image = pipe(
|
26 |
+
prompt,
|
27 |
+
negative_prompt='错误的眼睛,糟糕的人脸,毁容,糟糕的艺术,变形,多余的肢体,模糊的颜色,模糊,重复,病态,残缺,',
|
28 |
+
height=1024,
|
29 |
+
width=1024,
|
30 |
+
guidance_scale=6.0,
|
31 |
+
control_image=cond_image,
|
32 |
+
num_inference_steps=50,
|
33 |
+
).images[0]
|
34 |
+
```
|