Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,18 +40,18 @@ def main():
|
|
| 40 |
save_dir = Path(SAVE_DIR)
|
| 41 |
save_dir.mkdir(parents=True, exist_ok=True)
|
| 42 |
|
| 43 |
-
def pose(img_path,
|
| 44 |
-
if
|
| 45 |
-
|
| 46 |
|
| 47 |
cmd = CMD.format(save_dir, img_path)
|
| 48 |
-
if
|
| 49 |
cmd = cmd + " --use-cos"
|
| 50 |
-
if
|
| 51 |
cmd = cmd + " --use-angle-transf"
|
| 52 |
-
if
|
| 53 |
cmd = cmd + " --use-contacts"
|
| 54 |
-
if
|
| 55 |
cmd = cmd + " --use-natural"
|
| 56 |
|
| 57 |
out_dir = (save_dir / Path(img_path).name).with_suffix("")
|
|
@@ -64,19 +64,19 @@ def main():
|
|
| 64 |
|
| 65 |
examples = []
|
| 66 |
for img_path in Path("./data/images").glob("*"):
|
| 67 |
-
examples.append([str(img_path), True, True,
|
| 68 |
break
|
| 69 |
|
| 70 |
demo = gr.Interface(
|
| 71 |
fn=pose,
|
| 72 |
inputs=[
|
| 73 |
-
gr.Image(type="filepath"),
|
| 74 |
-
gr.Checkbox(value=True),
|
| 75 |
-
gr.Checkbox(value=True),
|
| 76 |
-
gr.Checkbox(value=False, interactive=torch.cuda.is_available()),
|
| 77 |
-
gr.Checkbox(value=True),
|
| 78 |
],
|
| 79 |
-
outputs=gr.Model3D(),
|
| 80 |
examples=examples,
|
| 81 |
)
|
| 82 |
|
|
|
|
| 40 |
save_dir = Path(SAVE_DIR)
|
| 41 |
save_dir.mkdir(parents=True, exist_ok=True)
|
| 42 |
|
| 43 |
+
def pose(img_path, use_cos=True, use_angle_transf=True, use_contacts=False, use_natural=True):
|
| 44 |
+
if use_cos == False:
|
| 45 |
+
use_angle_transf = False
|
| 46 |
|
| 47 |
cmd = CMD.format(save_dir, img_path)
|
| 48 |
+
if use_cos:
|
| 49 |
cmd = cmd + " --use-cos"
|
| 50 |
+
if use_angle_transf:
|
| 51 |
cmd = cmd + " --use-angle-transf"
|
| 52 |
+
if use_contacts:
|
| 53 |
cmd = cmd + " --use-contacts"
|
| 54 |
+
if use_natural:
|
| 55 |
cmd = cmd + " --use-natural"
|
| 56 |
|
| 57 |
out_dir = (save_dir / Path(img_path).name).with_suffix("")
|
|
|
|
| 64 |
|
| 65 |
examples = []
|
| 66 |
for img_path in Path("./data/images").glob("*"):
|
| 67 |
+
examples.append([str(img_path), True, True, False, True])
|
| 68 |
break
|
| 69 |
|
| 70 |
demo = gr.Interface(
|
| 71 |
fn=pose,
|
| 72 |
inputs=[
|
| 73 |
+
gr.Image(type="filepath", label="Image"),
|
| 74 |
+
gr.Checkbox(value=True, label="Bone lenghts"),
|
| 75 |
+
gr.Checkbox(value=True, label="Foreshortening"),
|
| 76 |
+
gr.Checkbox(value=False, label="Self-contacts (available with cuda)", interactive=torch.cuda.is_available()),
|
| 77 |
+
gr.Checkbox(value=True, label="Pose naturalness"),
|
| 78 |
],
|
| 79 |
+
outputs=gr.Model3D(clear_color=[0.0, 0.0, 0.0, 0.0], label="SMPL 3D pose"),
|
| 80 |
examples=examples,
|
| 81 |
)
|
| 82 |
|