kivantium commited on
Commit
e6b1571
·
unverified ·
1 Parent(s): ce2abf2

Show keypoints as text

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -2,7 +2,7 @@ import os
2
  os.system("pip install gradio==3.4")
3
  import gradio as gr
4
  os.system("pip install 'git+https://github.com/facebookresearch/detectron2.git'")
5
- os.system("git clone https://github.com/ShuhongChen/bizarre-pose-estimator.git")
6
  os.chdir("bizarre-pose-estimator")
7
 
8
  os.system("wget https://i.imgur.com/IkJzlaE.jpeg")
@@ -16,14 +16,17 @@ os.system("cp -a ./bizarre_pose_models/. .")
16
 
17
  import urllib.request
18
  from urllib.parse import urlparse
 
19
 
20
 
21
  def inference(url):
22
  filename = os.path.basename(urlparse(url).path)
23
  urllib.request.urlretrieve(url, filename)
24
  os.system("python3 -m _scripts.pose_estimator "+filename+" ./_train/character_pose_estim/runs/feat_concat+data.ckpt")
 
25
 
26
- return "./_samples/character_pose_estim.png"
 
27
 
28
 
29
  title = "bizarre-pose-estimator"
@@ -34,7 +37,7 @@ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.018
34
  gr.Interface(
35
  inference,
36
  gr.Textbox(lines=1, placeholder="Image URL"),
37
- gr.outputs.Image(type="file", label="Output"),
38
  title=title,
39
  description=description,
40
  article=article,
 
2
  os.system("pip install gradio==3.4")
3
  import gradio as gr
4
  os.system("pip install 'git+https://github.com/facebookresearch/detectron2.git'")
5
+ os.system("git clone https://github.com/kivantium/bizarre-pose-estimator.git")
6
  os.chdir("bizarre-pose-estimator")
7
 
8
  os.system("wget https://i.imgur.com/IkJzlaE.jpeg")
 
16
 
17
  import urllib.request
18
  from urllib.parse import urlparse
19
+ import numpy as np
20
 
21
 
22
  def inference(url):
23
  filename = os.path.basename(urlparse(url).path)
24
  urllib.request.urlretrieve(url, filename)
25
  os.system("python3 -m _scripts.pose_estimator "+filename+" ./_train/character_pose_estim/runs/feat_concat+data.ckpt")
26
+ keypoints = np.load("./_samples/keypoints.npy")
27
 
28
+
29
+ return ("./_samples/character_pose_estim.png", str(keypoints))
30
 
31
 
32
  title = "bizarre-pose-estimator"
 
37
  gr.Interface(
38
  inference,
39
  gr.Textbox(lines=1, placeholder="Image URL"),
40
+ [gr.outputs.Image(type="file", label="Output"), gr.Textbox(lines=10, placeholder="Keypoints")],
41
  title=title,
42
  description=description,
43
  article=article,