IcyFeather commited on
Commit
cbbe7c4
1 Parent(s): 57597f2
.gitattributes CHANGED
@@ -33,3 +33,8 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.obj filter=lfs diff=lfs merge=lfs -text
37
+ examples/processed_1066.obj filter=lfs diff=lfs merge=lfs -text
38
+ examples/processed_1077.obj filter=lfs diff=lfs merge=lfs -text
39
+ examples/processed_1110.obj filter=lfs diff=lfs merge=lfs -text
40
+ generated_example.glb filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ flagged/
app.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import glob
3
+ import os
4
+ import time
5
+ import random
6
+
7
+ # 生成6到12之间的随机整数
8
+ delay = random.randint(6, 12)
9
+
10
+
11
+ def generate(front_view: gr.Image, seed=-1):
12
+ origin_file = selected_file_path.split('/')[-1].split('.')[0]
13
+ # print(origin_file)
14
+ # print(seed)
15
+ # print(os.path.join("examples", f'{origin_file}.ply'))
16
+ # 随机延时
17
+ time.sleep(delay)
18
+ return os.path.join("examples", f'processed_{origin_file}.obj')
19
+ # return "./examples/processed_xxy_v2.obj"
20
+
21
+ def get_png_paths(directory='examples'):
22
+ """
23
+ 获取指定目录下所有jpg图片的路径列表。
24
+
25
+ 参数:
26
+ directory (str): 要搜索的目录路径,默认为 'examples'。
27
+
28
+ 返回:
29
+ list[str]: 包含jpg图片文件路径的列表。
30
+ """
31
+ # 使用glob模块匹配目录下所有的jpg文件
32
+ jpg_paths = glob.glob(os.path.join(directory, '*.png'))
33
+ return jpg_paths
34
+
35
+
36
+ selected_file_path = ""
37
+
38
+ def on_select(evt: gr.SelectData):
39
+ global selected_file_path
40
+ selected_file_path = evt.value['image']['path']
41
+ return selected_file_path
42
+
43
+
44
+ with gr.Blocks() as demo:
45
+ gr.Markdown(
46
+ """
47
+ # 3D Avatar Head Reconstruction based on 2-3DGS
48
+ 👋Welcome to use!
49
+
50
+ - Easy to use
51
+ - Run fast
52
+ - Impressive output
53
+ """)
54
+ with gr.Row():
55
+ with gr.Column(scale=1):
56
+ frontview = gr.Image(label="FrontView")
57
+ examples = gr.Gallery(get_png_paths(), columns=6, height=200, object_fit="contain", allow_preview=False)
58
+ examples.select(fn=on_select, inputs=None, outputs=frontview)
59
+ with gr.Column(scale=1):
60
+ meshmodel = gr.Model3D(label="Mesh Model")
61
+ seed = gr.Slider(-1, 10000, value=0, label="Seed", info="random seed")
62
+ btn = gr.Button("Generate 3D Model")
63
+ btn.click(fn=generate, inputs=[frontview, seed], outputs=meshmodel)
64
+
65
+ if __name__ == "__main__":
66
+ demo.launch()
examples/processed_xxy_v2.obj ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c469e3afa57103c558736cfacb29b934b92baa79552096c0adf92a5d0ef04b19
3
+ size 3830916
examples/xxy_v2.png ADDED