xmrt commited on
Commit
12f6446
1 Parent(s): 0e92268
Files changed (1) hide show
  1. main_noweb.py +10 -6
main_noweb.py CHANGED
@@ -66,7 +66,6 @@ def check_extension(video):
66
 
67
 
68
  def pose3d(video, kpt_threshold):
69
-
70
  video = check_extension(video)
71
  print(device)
72
 
@@ -209,7 +208,7 @@ with block:
209
  with gr.Row():
210
  with gr.Column():
211
  with gr.Row():
212
- video_input_web = gr.Video(source="webcam", height=256, width=192)
213
  # Insert slider with kpt_thr
214
  with gr.Column():
215
  gr.Markdown("Drag the keypoint threshold to filter out lower probability keypoints:")
@@ -218,6 +217,8 @@ with block:
218
  submit_pose_file_web = gr.Button("Make 2d pose estimation")
219
  submit_pose3d_file_web = gr.Button("Make 3d pose estimation")
220
  submit_hand_file_web = gr.Button("Make 2d hand estimation")
 
 
221
 
222
  with gr.Row():
223
  video_output1_web = gr.PlayableVideo(label = "Estimate human 2d poses", show_label=True, height=256)
@@ -241,7 +242,7 @@ with block:
241
  with gr.Row():
242
  with gr.Column():
243
  with gr.Row():
244
- video_input = gr.Video(source="upload", type="filepath", height=256, width=192)
245
  # Insert slider with kpt_thr
246
  with gr.Column():
247
  gr.Markdown("Drag the keypoint threshold to filter out lower probability keypoints:")
@@ -324,23 +325,26 @@ with block:
324
 
325
 
326
  # From file
327
- submit_pose_file.click(fn=pose2d,
328
  inputs= [video_input, file_kpthr],
329
  outputs = [video_output1, jsonoutput],
330
  queue=True)
331
 
332
- submit_pose3d_file.click(fn=pose3d,
333
  inputs= [video_input, file_kpthr],
334
  outputs = [video_output2, jsonoutput],
335
  #batch=True,
336
  #max_batch_size=16,
337
  queue=True) # Sometimes it worked with queue false? But still slow
338
 
339
- submit_hand_file.click(fn=pose2dhand,
340
  inputs= [video_input, file_kpthr],
341
  outputs = [video_output3, jsonoutput],
342
  queue=True)
343
 
 
 
 
344
  # From web
345
  submit_pose_file_web.click(fn=pose2d,
346
  inputs= [video_input_web, file_kpthr_web],
 
66
 
67
 
68
  def pose3d(video, kpt_threshold):
 
69
  video = check_extension(video)
70
  print(device)
71
 
 
208
  with gr.Row():
209
  with gr.Column():
210
  with gr.Row():
211
+ video_input_web = gr.Video(source="webcam", include_audio=False, height=256, width=192)
212
  # Insert slider with kpt_thr
213
  with gr.Column():
214
  gr.Markdown("Drag the keypoint threshold to filter out lower probability keypoints:")
 
217
  submit_pose_file_web = gr.Button("Make 2d pose estimation")
218
  submit_pose3d_file_web = gr.Button("Make 3d pose estimation")
219
  submit_hand_file_web = gr.Button("Make 2d hand estimation")
220
+ stop = gr.Button(value="Stop estimation")
221
+
222
 
223
  with gr.Row():
224
  video_output1_web = gr.PlayableVideo(label = "Estimate human 2d poses", show_label=True, height=256)
 
242
  with gr.Row():
243
  with gr.Column():
244
  with gr.Row():
245
+ video_input = gr.Video(source="upload", type="filepath", include_audio=False, height=256, width=192)
246
  # Insert slider with kpt_thr
247
  with gr.Column():
248
  gr.Markdown("Drag the keypoint threshold to filter out lower probability keypoints:")
 
325
 
326
 
327
  # From file
328
+ click1 = submit_pose_file.click(fn=pose2d,
329
  inputs= [video_input, file_kpthr],
330
  outputs = [video_output1, jsonoutput],
331
  queue=True)
332
 
333
+ click2 = submit_pose3d_file.click(fn=pose3d,
334
  inputs= [video_input, file_kpthr],
335
  outputs = [video_output2, jsonoutput],
336
  #batch=True,
337
  #max_batch_size=16,
338
  queue=True) # Sometimes it worked with queue false? But still slow
339
 
340
+ click3 = submit_hand_file.click(fn=pose2dhand,
341
  inputs= [video_input, file_kpthr],
342
  outputs = [video_output3, jsonoutput],
343
  queue=True)
344
 
345
+ stop.click(fn=None, inputs=None, outputs=None, cancels=[click1, click2, click3])
346
+
347
+
348
  # From web
349
  submit_pose_file_web.click(fn=pose2d,
350
  inputs= [video_input_web, file_kpthr_web],