xmrt commited on
Commit
92499cd
1 Parent(s): dd7a3e2

3d visualization

Browse files
Files changed (1) hide show
  1. main.py +26 -4
main.py CHANGED
@@ -28,7 +28,7 @@ print("[INFO]: Downloaded models!")
28
 
29
 
30
  def poses(photo):
31
- print(photo)
32
  result_generator = inferencer(photo,
33
  vis_out_dir =".",
34
  return_vis=True,
@@ -61,6 +61,8 @@ def poses(photo):
61
 
62
  return output_file
63
 
 
 
64
  # # specify detection model by alias
65
  # # the available aliases include 'human', 'hand', 'face', 'animal',
66
  # # as well as any additional aliases defined in mmdet
@@ -70,12 +72,32 @@ def poses(photo):
70
  # pose2d_weights='custom_human_pose_estimator.pth',
71
  # det_model='human'
72
  # )
 
73
 
74
  def run():
75
  #https://github.com/open-mmlab/mmpose/blob/main/docs/en/user_guides/inference.md
76
- demo = gr.Interface(fn=poses,
77
- inputs=gr.Video(source="upload"),
78
- outputs=gr.Video())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
 
81
  demo.launch(server_name="0.0.0.0", server_port=7860)
 
28
 
29
 
30
  def poses(photo):
31
+ print("[INFO]: Running inference!")
32
  result_generator = inferencer(photo,
33
  vis_out_dir =".",
34
  return_vis=True,
 
61
 
62
  return output_file
63
 
64
+
65
+
66
  # # specify detection model by alias
67
  # # the available aliases include 'human', 'hand', 'face', 'animal',
68
  # # as well as any additional aliases defined in mmdet
 
72
  # pose2d_weights='custom_human_pose_estimator.pth',
73
  # det_model='human'
74
  # )
75
+
76
 
77
  def run():
78
  #https://github.com/open-mmlab/mmpose/blob/main/docs/en/user_guides/inference.md
79
+
80
+ webcam = gr.Interface(
81
+ fn=poses,
82
+ inputs= gr.Video(source="webcam"),
83
+ outputs = gr.PlayableVideo(format='mp4', interactive=True),
84
+ title = 'Pose estimation',
85
+ description = 'Pose estimation on video',
86
+ allow_flagging=False
87
+ )
88
+
89
+ file = gr.Interface(
90
+ poses,
91
+ inputs = gr.Video(source="upload"),
92
+ outputs = gr.PlayableVideo(format='mp4', interactive=True),
93
+ #examples=os.path.join(os.path.dirname(__file__), "examples/aseptic_example.mp4"),
94
+ allow_flagging=False
95
+ )
96
+ demo = gr.TabbedInterface(
97
+ interface_list=[file, webcam],
98
+ tab_names=["From a File", "From your Webcam"]
99
+ )
100
+
101
 
102
 
103
  demo.launch(server_name="0.0.0.0", server_port=7860)