prithivMLmods commited on
Commit
40e111f
·
verified ·
1 Parent(s): fef4c1f

Delete demo.py

Browse files
Files changed (1) hide show
  1. demo.py +0 -45
demo.py DELETED
@@ -1,45 +0,0 @@
1
- import sys
2
- sys.path.insert(0, './hy3dshape')
3
- sys.path.insert(0, './hy3dpaint')
4
-
5
- from PIL import Image
6
- from hy3dshape.rembg import BackgroundRemover
7
- from hy3dshape.pipelines import Hunyuan3DDiTFlowMatchingPipeline
8
- from textureGenPipeline import Hunyuan3DPaintPipeline, Hunyuan3DPaintConfig
9
-
10
- try:
11
- from torchvision_fix import apply_fix
12
- apply_fix()
13
- except ImportError:
14
- print("Warning: torchvision_fix module not found, proceeding without compatibility fix")
15
- except Exception as e:
16
- print(f"Warning: Failed to apply torchvision fix: {e}")
17
-
18
- # shape
19
- model_path = 'tencent/Hunyuan3D-2.1'
20
- pipeline_shapegen = Hunyuan3DDiTFlowMatchingPipeline.from_pretrained(model_path)
21
-
22
- image_path = 'assets/demo.png'
23
- image = Image.open(image_path).convert("RGBA")
24
- if image.mode == 'RGB':
25
- rembg = BackgroundRemover()
26
- image = rembg(image)
27
-
28
- mesh = pipeline_shapegen(image=image)[0]
29
- mesh.export('demo.glb')
30
-
31
- # paint
32
- max_num_view = 6 # can be 6 to 9
33
- resolution = 512 # can be 768 or 512
34
- conf = Hunyuan3DPaintConfig(max_num_view, resolution)
35
- conf.realesrgan_ckpt_path = "hy3dpaint/ckpt/RealESRGAN_x4plus.pth"
36
- conf.multiview_cfg_path = "hy3dpaint/cfgs/hunyuan-paint-pbr.yaml"
37
- conf.custom_pipeline = "hy3dpaint/hunyuanpaintpbr"
38
- paint_pipeline = Hunyuan3DPaintPipeline(conf)
39
-
40
- output_mesh_path = 'demo_textured.glb'
41
- output_mesh_path = paint_pipeline(
42
- mesh_path = "demo.glb",
43
- image_path = 'assets/demo.png',
44
- output_mesh_path = output_mesh_path
45
- )