Spaces:
Running
Running
peterbonnesoeur
commited on
Commit
β’
b29351f
1
Parent(s):
2ab2985
Update app.py
Browse filesFix: gradio new naming conventions
app.py
CHANGED
@@ -8,15 +8,13 @@ def inference(img, ver, white_overlay):
|
|
8 |
white_overlay = ""
|
9 |
|
10 |
if ver == 'pose':
|
11 |
-
os.system("python -m openpifpaf.predict
|
12 |
elif ver == 'whole-body':
|
13 |
-
os.system("python -m openpifpaf.predict
|
14 |
-
--line-width 3 -o out.jpg")
|
15 |
elif ver == 'vehicles':
|
16 |
-
os.system("python -m openpifpaf.predict
|
17 |
elif ver == 'animal':
|
18 |
-
os.system("python -m openpifpaf.predict
|
19 |
-
--long-edge=500 -o out.jpg")
|
20 |
else:
|
21 |
raise ValueError('invalid version')
|
22 |
|
@@ -47,7 +45,7 @@ gr.Interface(
|
|
47 |
fn=inference,
|
48 |
inputs=[
|
49 |
gr.Image(type="filepath", label="Input"),
|
50 |
-
gr.Radio(['whole-body', 'pose', 'vehicles', 'animal'],
|
51 |
gr.Checkbox(default=False, label="White overlay")
|
52 |
],
|
53 |
outputs=gr.Image(type="filepath", label="Output"),
|
|
|
8 |
white_overlay = ""
|
9 |
|
10 |
if ver == 'pose':
|
11 |
+
os.system(f"python -m openpifpaf.predict {img} --checkpoint=shufflenetv2k30 --line-width=4 {white_overlay} -o out.jpg")
|
12 |
elif ver == 'whole-body':
|
13 |
+
os.system(f"python -m openpifpaf.predict {img} --checkpoint=shufflenetv2k30-wholebody --instance-threshold 0.05 {white_overlay} --seed-threshold 0.05 --line-width 3 -o out.jpg")
|
|
|
14 |
elif ver == 'vehicles':
|
15 |
+
os.system(f"python -m openpifpaf.predict {img} --checkpoint=shufflenetv2k16-apollo-24 --line-width=5 {white_overlay} -o out.jpg")
|
16 |
elif ver == 'animal':
|
17 |
+
os.system(f"python -m openpifpaf.predict {img} --checkpoint=shufflenetv2k30-animalpose --line-width=5 --font-size=6 {white_overlay} --long-edge=500 -o out.jpg")
|
|
|
18 |
else:
|
19 |
raise ValueError('invalid version')
|
20 |
|
|
|
45 |
fn=inference,
|
46 |
inputs=[
|
47 |
gr.Image(type="filepath", label="Input"),
|
48 |
+
gr.Radio(['whole-body', 'pose', 'vehicles', 'animal'], value='whole-body', label='version'),
|
49 |
gr.Checkbox(default=False, label="White overlay")
|
50 |
],
|
51 |
outputs=gr.Image(type="filepath", label="Output"),
|