kivantium commited on
Commit
986cced
·
unverified ·
1 Parent(s): e16576f

Add application file

Browse files
Files changed (2) hide show
  1. app.py +41 -0
  2. requirements.txt +18 -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/ShuhongChen/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()
requirements.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ pytorch-lightning
2
+ kornia
3
+ gdown
4
+ torchvision
5
+ torch
6
+
7
+ matplotlib==3.5.0
8
+ scipy==1.7.1
9
+ scikit-learn==1.0.1
10
+ scikit-image==0.18.3
11
+ imagesize==1.3.0
12
+ flask==2.0.2
13
+
14
+ patool==1.12
15
+ easydict==1.9
16
+ Pillow
17
+
18
+ opencv-python-headless