ac5113 commited on
Commit
7ca15bd
1 Parent(s): b807ddb

working gradio demo

Browse files
Files changed (2) hide show
  1. app.py +7 -5
  2. requirements.txt +3 -2
app.py CHANGED
@@ -4,10 +4,12 @@ import glob
4
  import numpy as np
5
  import cv2
6
  import PIL.Image as pil_img
7
- import sys
8
 
9
- # print(os.path.abspath(__file__))
10
- # os.system('pip install networkx==2.5')
 
 
11
 
12
  import gradio as gr
13
 
@@ -170,9 +172,9 @@ def main(pil_img, out_dir='demo_out', model_path='checkpoint/deco_best.pth', mes
170
 
171
  rend = create_scene(body_model_smpl, img)
172
  os.makedirs(os.path.join(out_dir, 'Renders'), exist_ok=True)
173
- rend.save(os.path.join(out_dir, 'Renders', os.path.basename(img_src).split('.')[0] + '.png'))
174
 
175
- mesh_out_dir = os.path.join(out_dir, 'Preds', os.path.basename(img_src).split('.')[0])
176
  os.makedirs(mesh_out_dir, exist_ok=True)
177
 
178
  print(f'Saving mesh to {mesh_out_dir}')
 
4
  import numpy as np
5
  import cv2
6
  import PIL.Image as pil_img
7
+ import subprocess
8
 
9
+ subprocess.run(
10
+ 'pip install networkx==2.5'
11
+ .split()
12
+ )
13
 
14
  import gradio as gr
15
 
 
172
 
173
  rend = create_scene(body_model_smpl, img)
174
  os.makedirs(os.path.join(out_dir, 'Renders'), exist_ok=True)
175
+ rend.save(os.path.join(out_dir, 'Renders', 'pred.png'))
176
 
177
+ mesh_out_dir = os.path.join(out_dir, 'Preds')
178
  os.makedirs(mesh_out_dir, exist_ok=True)
179
 
180
  print(f'Saving mesh to {mesh_out_dir}')
requirements.txt CHANGED
@@ -5,8 +5,7 @@ torchvision==0.14.0+cu117
5
  opencv-python
6
  loguru
7
  monai
8
- # pyrender==0.1.33
9
- pyrender
10
  smplx==0.1.28
11
  scikit-learn
12
  scikit-image
@@ -18,3 +17,5 @@ flatten_dict
18
  chumpy
19
  numpy==1.23.1
20
  yacs
 
 
 
5
  opencv-python
6
  loguru
7
  monai
8
+ pyrender==0.1.33
 
9
  smplx==0.1.28
10
  scikit-learn
11
  scikit-image
 
17
  chumpy
18
  numpy==1.23.1
19
  yacs
20
+ gradio
21
+ ipykernel