Sapphire-356 commited on
Commit
e6b5aa1
·
1 Parent(s): 4cdd405

upload Video2MC.png, update Markdown

Browse files
Files changed (2) hide show
  1. Video2MC.png +0 -0
  2. app.py +175 -37
Video2MC.png ADDED
app.py CHANGED
@@ -16,49 +16,187 @@ def Video2MC(video, progress=gr.Progress(track_tqdm=True)):
16
  with gr.Blocks() as iface:
17
 
18
  text1 = gr.Markdown(
19
- """
20
  <div align=center>
21
- <img src="https://github.com/Balloon-356/Video2MC/assets/114230565/2622c7b7-7b5d-458c-bd9a-dc0be37af370" />
22
- # </div>
23
- """
24
- # <h1 align="center">Video2MC: 基于3D人体姿态估计的MC动画自动生成</h1>
25
- )
26
- text2 = gr.Markdown(
27
- """
28
- <h1 align="center">Video2MC: 3D-HPE based Mine-imator animation generation</h1>
29
-
30
- Github: https://github.com/Balloon-356/Video2MC
31
-
32
- My Bilibili (Contact): https://space.bilibili.com/244384103
33
-
34
- Introduction:https://www.bilibili.com/video/BV1SP411W7pw
35
-
36
- implementation details:https://www.bilibili.com/read/cv25704198
37
-
38
- Using computer vision algorithms, I have achieved cost-effective "motion capture," and I am now officially releasing the Video2MC algorithm for automatic generation of Mine-imator animations!
39
-
40
- Enjoy it!
41
  """
42
- #
43
  )
44
-
45
- with gr.Row():
46
-
47
- with gr.Column():
48
- input_video = gr.Video()
49
- with gr.Row():
50
- btn_c = gr.ClearButton(input_video)
51
- btn_s = gr.Button("Submit", variant='primary')
52
- gr.Examples([os.path.join(os.path.dirname(__file__),
53
- "input_videos/kun_test_5sec.mp4")], input_video)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
- with gr.Column():
56
- output_miframes = gr.File()
57
- output_path = gr.Text()
58
- output_video = gr.Video()
 
 
 
 
 
 
 
 
 
 
 
 
 
59
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
60
 
61
- btn_s.click(Video2MC, inputs=[input_video], outputs=[output_miframes, output_path, output_video])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
 
64
  iface.queue(concurrency_count=10).launch()
 
16
  with gr.Blocks() as iface:
17
 
18
  text1 = gr.Markdown(
19
+ f"""
20
  <div align=center>
21
+ <img src="https://huggingface.co/spaces/Sapphire-356/Video2MC/blob/main/Video2MC.png" />
22
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  """
 
24
  )
25
+
26
+ with gr.Tab("English"):
27
+
28
+ text2 = gr.Markdown(
29
+ """
30
+ <h1 align="center">Video2MC: 3D-HPE based Mine-imator animation generation</h1>
31
+
32
+
33
+ ## Introduction
34
+
35
+ Using computer vision algorithms, I have achieved cost-effective "motion capture," and I am now officially releasing the Video2MC algorithm for automatic generation of Mine-imator animations!
36
+
37
+ Before using, it is **highly recommended** to watch my [introductory video](https://www.bilibili.com/video/BV1SP411W7pw), as it will help you quickly understand what this project is about.
38
+
39
+ Enjoy it!
40
+
41
+ """
42
+ )
43
+
44
+ with gr.Accordion("Related Links", open=False):
45
+
46
+ text_req = gr.Markdown(
47
+ """
48
+ ## Related Links
49
+
50
+ Github: https://github.com/Balloon-356/Video2MC
51
+
52
+ My Bilibili (Contact): https://space.bilibili.com/244384103
53
+
54
+ **Introductory video:** https://www.bilibili.com/video/BV1SP411W7pw
55
+
56
+ Implementation details: https://www.bilibili.com/read/cv25704198
57
+
58
+ """
59
+ )
60
+
61
+ with gr.Accordion("How to Use", open=False):
62
+
63
+ text_req = gr.Markdown(
64
+ """
65
+ ## How to Use
66
+
67
+ 1. Upload a video by dragging it into the box on the bottom left. The video must meet the **requirements**.
68
+
69
+ 2. Click "Submit", and the algorithm will start running. Please wait patiently, and you can see the current progress in the box on the right. (A 5s video takes about 5min.)
70
+
71
+ 3. Algorithm finished. You can download the .miframes file and preview the video rendered by the 3D-HPE algorithm (for previewing motion capture results).
72
+
73
+ 4. Import the .miframes file into the Mine-imator to create a Minecraft animation (you can learn how to use it on the Mine-imator forums).
74
+
75
+ 5. Fine-tune the motions of the skeleton model in Mine-imator.
76
+
77
+ """
78
+ )
79
+
80
+ with gr.Accordion("Video Requirements", open=False):
81
+
82
+ text_req = gr.Markdown(
83
+ """
84
+ ## Video Requirements
85
+
86
+ 1. Please upload short videos, preferably not exceeding 10 seconds. (Otherwise, the algorithm will run for several tens of mins and it still works.)
87
+
88
+ 2. The video should only contain one person, positioned at the center of the frame, fully visible from head to toe, facing the camera.
89
+
90
+ 3. Just as shown in the "example" below.
91
+
92
+ """
93
+ )
94
+
95
+ with gr.Row():
96
+
97
+ with gr.Column():
98
+ input_video = gr.Video()
99
+ with gr.Row():
100
+ btn_c = gr.ClearButton(input_video)
101
+ btn_s = gr.Button("Submit", variant='primary')
102
+ gr.Examples([os.path.join(os.path.dirname(__file__),
103
+ "input_videos/kun_test_5sec.mp4")], input_video)
104
+
105
+ with gr.Column():
106
+ output_miframes = gr.File()
107
+ output_path = gr.Text()
108
+ output_video = gr.Video()
109
+
110
 
111
+ btn_s.click(Video2MC, inputs=[input_video], outputs=[output_miframes, output_path, output_video])
112
+
113
+
114
+ with gr.Tab("中文"):
115
+
116
+ text2 = gr.Markdown(
117
+ """
118
+ <h1 align="center">Video2MC:基于3D-HPE的MC动画自动生成</h1>
119
+
120
+ ## 简单介绍
121
+
122
+ 利用计算机视觉算法,我实现了低成本“动作捕捉”,在此正式发布MC动画自动生成算法Video2MC!
123
+
124
+ 使用前,强烈建议先观看我的[B站视频](https://www.bilibili.com/video/BV1SP411W7pw),快速了解该项目的用法。
125
+
126
+ """
127
+ )
128
 
129
+
130
+ with gr.Accordion("相关链接", open=False):
131
+
132
+ text_req = gr.Markdown(
133
+ """
134
+ ## 相关链接
135
+
136
+ Github项目:https://github.com/Balloon-356/Video2MC
137
+
138
+ B站帐号(私信联系):https://space.bilibili.com/244384103
139
+
140
+ **介绍视频:** https://www.bilibili.com/video/BV1SP411W7pw
141
+
142
+ 实现原理:https://www.bilibili.com/read/cv25704198
143
+
144
+ """
145
+ )
146
 
147
+ with gr.Accordion("使用说明", open=False):
148
+
149
+ text_req = gr.Markdown(
150
+ """
151
+ ## 使用说明
152
+
153
+ 1. 上传一段视频(拖入下方左侧的框中)。视频需要满足“视频要求”。
154
+
155
+ 2. 点击“Submit”提交视频,此时算法开始运行。请耐心等待,右侧的框中将显示算法运行的进度。(5s的视频大约需要5分钟)
156
+
157
+ 3. 运行结束。可以在右侧的框中下载.miframes文件,并且可以通过算法渲染得到的骨架动作视频预览效果。
158
+
159
+ 4. 将.miframes文件导入到Mine-imator软件中,生成一段动画。(导入方法可在互联网上查询)
160
+
161
+ 5. 微调人物动作,导出动画。
162
+
163
+ """
164
+ )
165
+
166
+ with gr.Accordion("视频要求", open=False):
167
+
168
+ text_req = gr.Markdown(
169
+ """
170
+ ## 视频要求
171
+
172
+ 1. 请尽量上传时长较短的视频(10s内最好),否则算法将运行很长时间。
173
+
174
+ 2. 视频中应该只包含一个人,且人位于视频中心、全身完整地出现在视频中,面向相机。
175
+
176
+ 3. 如"example"中展示的视频一样。
177
+
178
+ """
179
+ )
180
+
181
+
182
+
183
+ with gr.Row():
184
+
185
+ with gr.Column():
186
+ input_video = gr.Video()
187
+ with gr.Row():
188
+ btn_c = gr.ClearButton(input_video)
189
+ btn_s = gr.Button("Submit", variant='primary')
190
+ gr.Examples([os.path.join(os.path.dirname(__file__),
191
+ "input_videos/kun_test_5sec.mp4")], input_video)
192
+
193
+ with gr.Column():
194
+ output_miframes = gr.File()
195
+ output_path = gr.Text()
196
+ output_video = gr.Video()
197
+
198
+
199
+ btn_s.click(Video2MC, inputs=[input_video], outputs=[output_miframes, output_path, output_video])
200
 
201
 
202
  iface.queue(concurrency_count=10).launch()