erer commited on
Commit
f863909
1 Parent(s): 908c0b8

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ os.system("pip install gradio==2.4.6")
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/hful/bizarre-pose-estimator.git")
6
+ os.chdir("bizarre-pose-estimator")
7
+
8
+ os.system("wget https://i.imgur.com/IkJzlaE.jpeg")
9
+
10
+ os.system("gdown https://drive.google.com/uc?id=1qhnBmMdDTC_8kmNj4u2f_Htfvg6KuE14")
11
+
12
+
13
+ os.system("unzip bizarre_pose_models.zip")
14
+ os.system("cp -a ./bizarre_pose_models/. .")
15
+
16
+
17
+ os.system("ls")
18
+
19
+ def inference(img):
20
+ os.system("python3 -m _scripts.pose_estimator "+img+" ./_train/character_pose_estim/runs/feat_concat+data.ckpt")
21
+
22
+ return "./_samples/character_pose_estim.png"
23
+
24
+
25
+ title = "bizarre-pose-estimator"
26
+ description = "Gradio demo for Transfer Learning for Pose Estimation of Illustrated Characters. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
27
+
28
+ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.01819' target='_blank'>Transfer Learning for Pose Estimation of Illustrated Characters</a> | <a href='https://github.com/ShuhongChen/bizarre-pose-estimator' target='_blank'>Github Repo</a></p>"
29
+
30
+ examples=[["IkJzlaE.jpeg"]]
31
+ gr.Interface(
32
+ inference,
33
+ gr.inputs.Image(type="filepath", label="Input"),
34
+ gr.outputs.Image(type="file", label="Output"),
35
+ title=title,
36
+ description=description,
37
+ article=article,
38
+ allow_flagging="never",
39
+ examples=examples,
40
+ enable_queue=True
41
+ ).launch()