Skip to content

Commit

Permalink
[Fix] fix RTMPose app (#2880)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Louis authored Dec 20, 2023
1 parent 5da5ba6 commit 052f388
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions projects/rtmpose/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,31 @@
import os
from functools import partial

import gradio as gr

# prepare environment
project_path = os.path.join(os.path.dirname(os.path.abspath(__file__)))
mmpose_path = project_path.split('/projects', 1)[0]

os.system('python -m pip install Openmim')
os.system('python -m pip install openxlab')
os.system('python -m pip install gradio==3.38.0')

os.system('python -m mim install "mmcv>=2.0.0"')
os.system('python -m mim install "mmengine>=0.9.0"')
os.system('python -m mim install "mmdet>=3.0.0"')
os.system(f'python -m mim install -e {mmpose_path}')

import gradio as gr # noqa
from openxlab.model import download # noqa

from mmpose.apis import MMPoseInferencer # noqa

# download checkpoints
download(model_repo='mmpose/RTMPose', model_name='dwpose-l')
download(model_repo='mmpose/RTMPose', model_name='RTMW-x')
download(model_repo='mmpose/RTMPose', model_name='RTMO-l')
download(model_repo='mmpose/RTMPose', model_name='RTMPose-l-body8')
download(model_repo='mmpose/RTMPose', model_name='RTMPose-m-face6')

models = [
'rtmpose | body', 'rtmo | body', 'rtmpose | face', 'dwpose | wholebody',
'rtmw | wholebody'
Expand Down Expand Up @@ -115,12 +127,7 @@ def predict(input,
input_img = gr.Image(type='numpy')
button = gr.Button('Inference', variant='primary')
hm = gr.Checkbox(label='draw-heatmap', info='Whether to draw heatmap')
model_type = gr.Dropdown([
'rtmpose | body', 'rtmo | body', 'rtmpose | face',
'dwpose | wholebody', 'rtmw | wholebody'
],
label='Model | Keypoint Type',
info='Body / Face / Wholebody')
model_type = gr.Dropdown(models, label='Model | Keypoint Type')

gr.Markdown('## News')
for news in news_list[::-1]:
Expand All @@ -138,12 +145,7 @@ def predict(input,
input_img = gr.Image(source='webcam', type='numpy')
button = gr.Button('Inference', variant='primary')
hm = gr.Checkbox(label='draw-heatmap', info='Whether to draw heatmap')
model_type = gr.Dropdown([
'rtmpose | body', 'rtmo | body', 'rtmpose | face',
'dwpose | wholebody', 'rtmw | wholebody'
],
label='Model | Keypoint Type',
info='Body / Face / Wholebody')
model_type = gr.Dropdown(models, label='Model | Keypoint Type')

gr.Markdown('## News')
for news in news_list[::-1]:
Expand All @@ -161,12 +163,7 @@ def predict(input,
input_video = gr.Video(type='mp4')
button = gr.Button('Inference', variant='primary')
hm = gr.Checkbox(label='draw-heatmap', info='Whether to draw heatmap')
model_type = gr.Dropdown([
'rtmpose | body', 'rtmo | body', 'rtmpose | face',
'dwpose | wholebody', 'rtmw | wholebody'
],
label='Model | Keypoint type',
info='Body / Face / Wholebody')
model_type = gr.Dropdown(models, label='Model | Keypoint type')

gr.Markdown('## News')
for news in news_list[::-1]:
Expand All @@ -184,12 +181,7 @@ def predict(input,
input_video = gr.Video(source='webcam', format='mp4')
button = gr.Button('Inference', variant='primary')
hm = gr.Checkbox(label='draw-heatmap', info='Whether to draw heatmap')
model_type = gr.Dropdown([
'rtmpose | body', 'rtmo | body', 'rtmpose | face',
'dwpose | wholebody', 'rtmw | wholebody'
],
label='Model | Keypoint Type',
info='Body / Face / Wholebody')
model_type = gr.Dropdown(models, label='Model | Keypoint Type')

gr.Markdown('## News')
for news in news_list[::-1]:
Expand Down

0 comments on commit 052f388

Please sign in to comment.