kleinhe commited on
Commit
479b355
Β·
1 Parent(s): 50a02f4
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -9,10 +9,10 @@ css = """
9
 
10
  from huggingface_hub import snapshot_download
11
  from motion.visual_api import Visualize
12
- import cv2
13
  import torch
14
  import json
15
  from tqdm import tqdm
 
16
 
17
  with open("motion/path.json", "r") as f:
18
  json_dict = json.load(f)
@@ -73,12 +73,7 @@ def demo(prompt, mode, condition, render_mode="joints", skip_steps=0, out_size=1
73
  meshes, _ = visual.get_mesh(output)
74
  pics = visual.pyrender_process(meshes, out_size, out_size)
75
 
76
- video=cv2.VideoWriter(video_path,cv2.VideoWriter_fourcc(*'MP4V'),20,(out_size, out_size))
77
- for pic in tqdm(pics):
78
- pic = pic[:, :, :3]
79
- pic = cv2.cvtColor(pic, cv2.COLOR_BGR2RGB)
80
- video.write(pic) #写ε…₯视钑
81
- video.release()
82
 
83
  if mode[i] == "cadm":
84
  out_paths[0] = video_path
@@ -111,9 +106,9 @@ def t2m_demo():
111
 
112
  with gr.Blocks(analytics_enabled=False, css=css) as t2m_interface:
113
  gr.Markdown("<div align='center'> <h2> πŸ€·β€β™‚οΈ SemanticBoost: Elevating Motion Generation with Augmented Textual Cues </span> </h2> \
114
- <a style='font-size:18px;color: #000000' href='https://arxiv.org/abs/2211.12194'>Arxiv</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
115
- <a style='font-size:18px;color: #000000' href='https://sadtalker.github.io'>Homepage</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
116
- <a style='font-size:18px;color: #000000' href='https://github.com/blackgold3/SemanticBoost'> Github </div>")
117
 
118
  with gr.Row().style(equal_height=True):
119
  with gr.Column(variant='panel'):
@@ -142,21 +137,21 @@ def t2m_demo():
142
  with gr.TabItem('Results'):
143
  with gr.Row():
144
  with gr.Column():
145
- gen_video = gr.Video(label="CADM", format="mp4", autoplay=True, elem_classes="ov")
146
  with gr.Column():
147
  joint_file = gr.File(label="CADM-Joints", value=None, elem_classes="dfile")
148
  smpl_file = gr.File(label="CADM-SMPL", value=None, elem_classes="dfile")
149
 
150
  with gr.Row():
151
  with gr.Column():
152
- gen_video1 = gr.Video(label="CADM-Augment", format="mp4", autoplay=True, elem_classes="ov")
153
  with gr.Column():
154
  joint_file1 = gr.File(label="CADM-Augment-Joints", value=None, elem_classes="dfile")
155
  smpl_file1 = gr.File(label="CADM-Augment-SMPL", value=None, elem_classes="dfile")
156
 
157
  with gr.Row():
158
  with gr.Column():
159
- gen_video2 = gr.Video(label="MDM", format="mp4", autoplay=True, elem_classes="ov")
160
  with gr.Column():
161
  joint_file2 = gr.File(label="MDM-Joints", value=None, elem_classes="dfile")
162
  smpl_file2 = gr.File(label="MDM-SMPL", value=None, elem_classes="dfile")
 
9
 
10
  from huggingface_hub import snapshot_download
11
  from motion.visual_api import Visualize
 
12
  import torch
13
  import json
14
  from tqdm import tqdm
15
+ import imageio
16
 
17
  with open("motion/path.json", "r") as f:
18
  json_dict = json.load(f)
 
73
  meshes, _ = visual.get_mesh(output)
74
  pics = visual.pyrender_process(meshes, out_size, out_size)
75
 
76
+ imageio.mimsave(video_path, pics, duration= 1000 / 20, loop=0)
 
 
 
 
 
77
 
78
  if mode[i] == "cadm":
79
  out_paths[0] = video_path
 
106
 
107
  with gr.Blocks(analytics_enabled=False, css=css) as t2m_interface:
108
  gr.Markdown("<div align='center'> <h2> πŸ€·β€β™‚οΈ SemanticBoost: Elevating Motion Generation with Augmented Textual Cues </span> </h2> \
109
+ <a style='font-size:18px;' href=''>Arxiv</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
110
+ <a style='font-size:18px;' href='https://blackgold3.github.io/SemanticBoost/'>Homepage</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
111
+ <a style='font-size:18px;' href='https://github.com/blackgold3/SemanticBoost'> Github </div>")
112
 
113
  with gr.Row().style(equal_height=True):
114
  with gr.Column(variant='panel'):
 
137
  with gr.TabItem('Results'):
138
  with gr.Row():
139
  with gr.Column():
140
+ gen_video = gr.Image(label="CADM", elem_classes="ov")
141
  with gr.Column():
142
  joint_file = gr.File(label="CADM-Joints", value=None, elem_classes="dfile")
143
  smpl_file = gr.File(label="CADM-SMPL", value=None, elem_classes="dfile")
144
 
145
  with gr.Row():
146
  with gr.Column():
147
+ gen_video1 = gr.Image(label="CADM-Augment", elem_classes="ov")
148
  with gr.Column():
149
  joint_file1 = gr.File(label="CADM-Augment-Joints", value=None, elem_classes="dfile")
150
  smpl_file1 = gr.File(label="CADM-Augment-SMPL", value=None, elem_classes="dfile")
151
 
152
  with gr.Row():
153
  with gr.Column():
154
+ gen_video2 = gr.Image(label="MDM", elem_classes="ov")
155
  with gr.Column():
156
  joint_file2 = gr.File(label="MDM-Joints", value=None, elem_classes="dfile")
157
  smpl_file2 = gr.File(label="MDM-SMPL", value=None, elem_classes="dfile")