markdown slider and max threads
Browse files- main.py +1 -0
- main_noweb.py +16 -4
main.py
CHANGED
@@ -161,6 +161,7 @@ def pose2d(video, kpt_threshold):
|
|
161 |
out_file = glob.glob(os.path.join(add_dir, "*.mp4")) #+ glob.glob(os.path.join(vis_out_dir, "*.webm"))
|
162 |
kpoints = glob.glob(os.path.join(add_dir, "*.json"))
|
163 |
|
|
|
164 |
return "".join(out_file), "".join(kpoints)
|
165 |
|
166 |
|
|
|
161 |
out_file = glob.glob(os.path.join(add_dir, "*.mp4")) #+ glob.glob(os.path.join(vis_out_dir, "*.webm"))
|
162 |
kpoints = glob.glob(os.path.join(add_dir, "*.json"))
|
163 |
|
164 |
+
|
165 |
return "".join(out_file), "".join(kpoints)
|
166 |
|
167 |
|
main_noweb.py
CHANGED
@@ -34,6 +34,8 @@ print("[INFO]: Imported modules!")
|
|
34 |
human = MMPoseInferencer("simcc_mobilenetv2_wo-deconv-8xb64-210e_coco-256x192") # simcc_mobilenetv2_wo-deconv-8xb64-210e_coco-256x192 dekr_hrnet-w32_8xb10-140e_coco-512x512
|
35 |
hand = MMPoseInferencer("hand")
|
36 |
|
|
|
|
|
37 |
#"https://github.com/open-mmlab/mmpose/blob/main/configs/body_3d_keypoint/pose_lift/h36m/pose-lift_simplebaseline3d_8xb64-200e_h36m.py",
|
38 |
#"https://download.openmmlab.com/mmpose/body3d/simple_baseline/simple3Dbaseline_h36m-f0ad73a4_20210419.pth") # pose3d="human3d"
|
39 |
#https://github.com/open-mmlab/mmpose/tree/main/configs/hand_2d_keypoint/topdown_regression
|
@@ -96,6 +98,7 @@ def pose3d(video, kpt_threshold):
|
|
96 |
print(device)
|
97 |
|
98 |
human3d = MMPoseInferencer(pose3d="human3d")
|
|
|
99 |
|
100 |
# Define new unique folder
|
101 |
add_dir = str(uuid.uuid4())
|
@@ -151,6 +154,15 @@ def pose2d(video, kpt_threshold):
|
|
151 |
|
152 |
return "".join(out_file), "".join(kpoints)
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
|
155 |
def pose2dhand(video, kpt_threshold):
|
156 |
video = check_extension(video)
|
@@ -298,7 +310,7 @@ def UI():
|
|
298 |
|
299 |
|
300 |
# From file
|
301 |
-
submit_pose_file.click(fn=
|
302 |
inputs= [video_input, file_kpthr],
|
303 |
outputs = [video_output1, jsonoutput],
|
304 |
queue=True)
|
@@ -316,12 +328,12 @@ def UI():
|
|
316 |
|
317 |
if __name__ == "__main__":
|
318 |
block = UI()
|
319 |
-
block.queue(
|
320 |
-
|
321 |
#max_size=25, # Maximum number of requests that the queue processes
|
322 |
api_open = False # When creating a Gradio demo, you may want to restrict all traffic to happen through the user interface as opposed to the programmatic API that is automatically created for your Gradio demo.
|
323 |
).launch(
|
324 |
-
max_threads=41,
|
325 |
server_name="0.0.0.0",
|
326 |
server_port=7860,
|
327 |
auth=("novouser", "bstad2023")
|
|
|
34 |
human = MMPoseInferencer("simcc_mobilenetv2_wo-deconv-8xb64-210e_coco-256x192") # simcc_mobilenetv2_wo-deconv-8xb64-210e_coco-256x192 dekr_hrnet-w32_8xb10-140e_coco-512x512
|
35 |
hand = MMPoseInferencer("hand")
|
36 |
|
37 |
+
hand.to(device)
|
38 |
+
human.to(device)
|
39 |
#"https://github.com/open-mmlab/mmpose/blob/main/configs/body_3d_keypoint/pose_lift/h36m/pose-lift_simplebaseline3d_8xb64-200e_h36m.py",
|
40 |
#"https://download.openmmlab.com/mmpose/body3d/simple_baseline/simple3Dbaseline_h36m-f0ad73a4_20210419.pth") # pose3d="human3d"
|
41 |
#https://github.com/open-mmlab/mmpose/tree/main/configs/hand_2d_keypoint/topdown_regression
|
|
|
98 |
print(device)
|
99 |
|
100 |
human3d = MMPoseInferencer(pose3d="human3d")
|
101 |
+
human3d.to(device)
|
102 |
|
103 |
# Define new unique folder
|
104 |
add_dir = str(uuid.uuid4())
|
|
|
154 |
|
155 |
return "".join(out_file), "".join(kpoints)
|
156 |
|
157 |
+
def pose2dbatch(video, kpt_threshold):
|
158 |
+
kpoints=[]
|
159 |
+
outvids=[]
|
160 |
+
for v, t in zip(video, kpt_threshold):
|
161 |
+
vname, kname = pose2d(v, t)
|
162 |
+
outvids.append(vname)
|
163 |
+
kpoints.append(kname)
|
164 |
+
return kpoints, outvids
|
165 |
+
|
166 |
|
167 |
def pose2dhand(video, kpt_threshold):
|
168 |
video = check_extension(video)
|
|
|
310 |
|
311 |
|
312 |
# From file
|
313 |
+
submit_pose_file.click(fn=pose2dbatch,
|
314 |
inputs= [video_input, file_kpthr],
|
315 |
outputs = [video_output1, jsonoutput],
|
316 |
queue=True)
|
|
|
328 |
|
329 |
if __name__ == "__main__":
|
330 |
block = UI()
|
331 |
+
block.queue(max_size=50,
|
332 |
+
concurrency_count=20, # When you increase the concurrency_count parameter in queue(), max_threads() in launch() is automatically increased as well.
|
333 |
#max_size=25, # Maximum number of requests that the queue processes
|
334 |
api_open = False # When creating a Gradio demo, you may want to restrict all traffic to happen through the user interface as opposed to the programmatic API that is automatically created for your Gradio demo.
|
335 |
).launch(
|
336 |
+
#max_threads=41,
|
337 |
server_name="0.0.0.0",
|
338 |
server_port=7860,
|
339 |
auth=("novouser", "bstad2023")
|