yetshuan commited on
Commit
7150d6e
1 Parent(s): bde1415

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +26 -0
README.md ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from diffusers import HunyuanDiT2DControlNetModel, HunyuanDiTControlNetPipeline
2
+ import torch
3
+
4
+
5
+ controlnet = HunyuanDiT2DControlNetModel.from_pretrained("Tencent-Hunyuan/HunyuanDiT-v1.2-ControlNet-Diffusers-Distilled-Depth", torch_dtype=torch.float16)
6
+
7
+ pipe = HunyuanDiTControlNetPipeline.from_pretrained("Tencent-Hunyuan/HunyuanDiT-v1.2-Diffusers-Distilled", controlnet=controlnet, torch_dtype=torch.float16)
8
+ pipe.to("cuda")
9
+
10
+ from diffusers.utils import load_image
11
+ cond_image = load_image('https://huggingface.co/Tencent-Hunyuan/HunyuanDiT-v1.2-ControlNet-Diffusers-Distilled-Depth/resolve/main/depth.jpg?download=true')
12
+
13
+ ## You may also use English prompt as HunyuanDiT supports both English and Chinese
14
+ prompt="在茂密的森林中,一只黑白相间的熊猫静静地坐在绿树红花中,周围是山川和海洋。背景是白天的森林,光线充足。照片采用特写、平视和居中构图的方式,呈现出写实的效果"
15
+ #prompt="In the dense forest, a black and white panda sits quietly among the green trees and red flowers, surrounded by mountains and oceans. The background is a daytime forest with ample light. The photo uses a close-up, eye-level, and centered composition to create a realistic effect."
16
+
17
+ torch.manual_seed(42)
18
+ image = pipe(
19
+ prompt,
20
+ negative_prompt='错误的眼睛,糟糕的人脸,毁容,糟糕的艺术,变形,多余的肢体,模糊的颜色,模糊,重复,病态,残缺,',
21
+ height=1024,
22
+ width=1024,
23
+ guidance_scale=6.0,
24
+ control_image=cond_image,
25
+ num_inference_steps=50,
26
+ ).images[0]