file display
Browse files
main.py
CHANGED
@@ -32,28 +32,28 @@ print("[INFO]: Downloaded models!")
|
|
32 |
|
33 |
def poses(photo, check):
|
34 |
# Selecting the specific inferencer
|
|
|
|
|
|
|
35 |
|
36 |
-
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
thickness=2,
|
46 |
-
rebase_keypoint_height=True)
|
47 |
-
|
48 |
-
result = [result for result in result_generator] #next(result_generator)
|
49 |
-
|
50 |
-
output_files = glob.glob(os.path.join(vis_out_dir, "*.mp4"))
|
51 |
-
# 00000.mp4
|
52 |
-
# 000000.mp4
|
53 |
-
|
54 |
-
return output_files[0]
|
55 |
|
|
|
|
|
|
|
|
|
56 |
|
|
|
57 |
|
58 |
# # specify detection model by alias
|
59 |
# # the available aliases include 'human', 'hand', 'face', 'animal',
|
@@ -75,7 +75,7 @@ def run():
|
|
75 |
webcam = gr.Interface(
|
76 |
fn=poses,
|
77 |
inputs= [gr.Video(source="webcam", height=412), check_web],
|
78 |
-
outputs = gr.PlayableVideo(), #file_types=['.mp4'] #gr.Video(),
|
79 |
title = 'Pose estimation',
|
80 |
description = 'Pose estimation on video',
|
81 |
allow_flagging=False
|
@@ -84,7 +84,7 @@ def run():
|
|
84 |
file = gr.Interface(
|
85 |
poses,
|
86 |
inputs = [gr.Video(source="upload", height=412), check_file],
|
87 |
-
outputs = gr.PlayableVideo(),
|
88 |
allow_flagging=False
|
89 |
)
|
90 |
|
|
|
32 |
|
33 |
def poses(photo, check):
|
34 |
# Selecting the specific inferencer
|
35 |
+
out_files=[]
|
36 |
+
for i in len(check):
|
37 |
+
inferencer = inferencers[check] # 'hand', 'human , device='cuda'
|
38 |
|
39 |
+
print("[INFO]: Running inference!")
|
40 |
+
# Create out directory
|
41 |
+
vis_out_dir = str(uuid.uuid4())
|
42 |
|
43 |
+
result_generator = inferencer(photo,
|
44 |
+
vis_out_dir = vis_out_dir,
|
45 |
+
return_vis=True,
|
46 |
+
thickness=2,
|
47 |
+
rebase_keypoint_height=True)
|
48 |
+
|
49 |
+
result = [result for result in result_generator] #next(result_generator)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
+
out_file = glob.glob(os.path.join(vis_out_dir, "*.mp4"))
|
52 |
+
# 00000.mp4
|
53 |
+
# 000000.mp4
|
54 |
+
out_files.append(out_file)
|
55 |
|
56 |
+
return out_files
|
57 |
|
58 |
# # specify detection model by alias
|
59 |
# # the available aliases include 'human', 'hand', 'face', 'animal',
|
|
|
75 |
webcam = gr.Interface(
|
76 |
fn=poses,
|
77 |
inputs= [gr.Video(source="webcam", height=412), check_web],
|
78 |
+
outputs = [gr.PlayableVideo()]*len(check_web), #file_types=['.mp4'] #gr.Video(),
|
79 |
title = 'Pose estimation',
|
80 |
description = 'Pose estimation on video',
|
81 |
allow_flagging=False
|
|
|
84 |
file = gr.Interface(
|
85 |
poses,
|
86 |
inputs = [gr.Video(source="upload", height=412), check_file],
|
87 |
+
outputs = [gr.PlayableVideo()]*len(check_file),
|
88 |
allow_flagging=False
|
89 |
)
|
90 |
|