Spaces:
Paused
Paused
Commit
·
4d5ee9e
1
Parent(s):
504e17a
update video codec
Browse files
app.py
CHANGED
|
@@ -16,6 +16,7 @@ import gradio as gr
|
|
| 16 |
import numpy as np
|
| 17 |
import pandas as pd
|
| 18 |
import plotly.graph_objs as go
|
|
|
|
| 19 |
import torch
|
| 20 |
from metrabs_pytorch.scripts.run_video import run_metrabs_video
|
| 21 |
from myo_tools.mjs.marker.marker_api import get_marker_names
|
|
@@ -46,7 +47,7 @@ def draw_keypoints(frame, poses2d, radius=10):
|
|
| 46 |
|
| 47 |
|
| 48 |
def save_video_with_keypoints(results, output_video):
|
| 49 |
-
fourcc = cv2.VideoWriter_fourcc(*"
|
| 50 |
out = cv2.VideoWriter(
|
| 51 |
output_video,
|
| 52 |
fourcc,
|
|
@@ -222,6 +223,7 @@ def run_retargeting_c3d(api_key, c3d_files, markerset_file):
|
|
| 222 |
)
|
| 223 |
|
| 224 |
|
|
|
|
| 225 |
def run_retargeting_video(
|
| 226 |
api_key,
|
| 227 |
video_file="",
|
|
@@ -307,7 +309,7 @@ def run_retargeting_video(
|
|
| 307 |
visible=False,
|
| 308 |
), video_with_keypoints
|
| 309 |
client = Client(api_key=api_key)
|
| 310 |
-
|
| 311 |
status.append(
|
| 312 |
f"🔹 MyoSDK client initialized in { time.time() - init_time:.2f} seconds"
|
| 313 |
)
|
|
@@ -325,6 +327,7 @@ def run_retargeting_video(
|
|
| 325 |
status.append(
|
| 326 |
f"🔹 Markerset file uploaded in {time.time() - init_time:.2f} seconds"
|
| 327 |
)
|
|
|
|
| 328 |
|
| 329 |
yield "\n".join(status), None, None, gr.update(value=[]), gr.update(
|
| 330 |
visible=False
|
|
@@ -381,7 +384,8 @@ def run_retargeting_video(
|
|
| 381 |
data = np.load(out_path)
|
| 382 |
joint_angles = data["joint_angles_degrees"].squeeze()
|
| 383 |
joint_names = data["joint_names"]
|
| 384 |
-
|
|
|
|
| 385 |
df = pd.DataFrame(joint_angles, columns=[jn for jn in joint_names])
|
| 386 |
df.insert(0, "frame", df.index)
|
| 387 |
|
|
|
|
| 16 |
import numpy as np
|
| 17 |
import pandas as pd
|
| 18 |
import plotly.graph_objs as go
|
| 19 |
+
import spaces
|
| 20 |
import torch
|
| 21 |
from metrabs_pytorch.scripts.run_video import run_metrabs_video
|
| 22 |
from myo_tools.mjs.marker.marker_api import get_marker_names
|
|
|
|
| 47 |
|
| 48 |
|
| 49 |
def save_video_with_keypoints(results, output_video):
|
| 50 |
+
fourcc = cv2.VideoWriter_fourcc(*"mp4v")
|
| 51 |
out = cv2.VideoWriter(
|
| 52 |
output_video,
|
| 53 |
fourcc,
|
|
|
|
| 223 |
)
|
| 224 |
|
| 225 |
|
| 226 |
+
@spaces.GPU
|
| 227 |
def run_retargeting_video(
|
| 228 |
api_key,
|
| 229 |
video_file="",
|
|
|
|
| 309 |
visible=False,
|
| 310 |
), video_with_keypoints
|
| 311 |
client = Client(api_key=api_key)
|
| 312 |
+
print(f"🔹 MyoSDK client initialized in { time.time() - init_time:.2f} seconds")
|
| 313 |
status.append(
|
| 314 |
f"🔹 MyoSDK client initialized in { time.time() - init_time:.2f} seconds"
|
| 315 |
)
|
|
|
|
| 327 |
status.append(
|
| 328 |
f"🔹 Markerset file uploaded in {time.time() - init_time:.2f} seconds"
|
| 329 |
)
|
| 330 |
+
print(f"🔹 Markerset file uploaded in {time.time() - init_time:.2f} seconds")
|
| 331 |
|
| 332 |
yield "\n".join(status), None, None, gr.update(value=[]), gr.update(
|
| 333 |
visible=False
|
|
|
|
| 384 |
data = np.load(out_path)
|
| 385 |
joint_angles = data["joint_angles_degrees"].squeeze()
|
| 386 |
joint_names = data["joint_names"]
|
| 387 |
+
print(joint_angles)
|
| 388 |
+
print(joint_names)
|
| 389 |
df = pd.DataFrame(joint_angles, columns=[jn for jn in joint_names])
|
| 390 |
df.insert(0, "frame", df.index)
|
| 391 |
|