Yuliang commited on
Commit
fe5fe63
1 Parent(s): b151252

fixed types for examples

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +11 -7
  3. apps/infer.py +1 -1
README.md CHANGED
@@ -5,7 +5,7 @@ emoji: 🤼
5
  colorFrom: indigo
6
  colorTo: yellow
7
  sdk: gradio
8
- sdk_version: 3.1.3
9
  app_file: app.py
10
  pinned: true
11
  python_version: 3.8.13
 
5
  colorFrom: indigo
6
  colorTo: yellow
7
  sdk: gradio
8
+ sdk_version: 3.1.4
9
  app_file: app.py
10
  pinned: true
11
  python_version: 3.8.13
app.py CHANGED
@@ -4,7 +4,7 @@
4
  import glob
5
  import gradio as gr
6
  import os
7
- import random
8
 
9
  import subprocess
10
 
@@ -16,7 +16,8 @@ if os.getenv('SYSTEM') == 'spaces':
16
  'pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html'.split())
17
  subprocess.run(
18
  'pip install https://download.is.tue.mpg.de/icon/HF/kaolin-0.11.0-cp38-cp38-linux_x86_64.whl'.split())
19
- subprocess.run('pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/py38_cu113_pyt1110/download.html'.split())
 
20
  subprocess.run(
21
  'pip install git+https://github.com/Project-Splinter/human_det.git'.split())
22
  subprocess.run(
@@ -93,10 +94,12 @@ def generate_image(seed, psi):
93
  return img
94
 
95
 
96
- random.seed(2022)
97
  model_types = ['ICON', 'PIFu', 'PaMIR']
98
- examples = [[item, random.choice(model_types)]
99
- for item in glob.glob('examples/*.png')]
 
 
 
100
 
101
  with gr.Blocks() as demo:
102
  gr.Markdown(description)
@@ -119,11 +122,12 @@ with gr.Blocks() as demo:
119
 
120
  gr.Examples(examples=examples,
121
  inputs=[inp, radio_choice],
122
- cache_examples=True,
123
  fn=generate_model,
124
  outputs=out_lst)
125
 
126
- out_vid = gr.Video(label="Image + Normal + SMPL Body + Clothed Human")
 
127
  out_vid_download = gr.File(
128
  label="Download Video, welcome share on Twitter with #ICON")
129
 
 
4
  import glob
5
  import gradio as gr
6
  import os
7
+ import numpy as np
8
 
9
  import subprocess
10
 
 
16
  'pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html'.split())
17
  subprocess.run(
18
  'pip install https://download.is.tue.mpg.de/icon/HF/kaolin-0.11.0-cp38-cp38-linux_x86_64.whl'.split())
19
+ subprocess.run(
20
+ 'pip install https://download.is.tue.mpg.de/icon/HF/pytorch3d-0.7.0-cp38-cp38-linux_x86_64.whl'.split())
21
  subprocess.run(
22
  'pip install git+https://github.com/Project-Splinter/human_det.git'.split())
23
  subprocess.run(
 
94
  return img
95
 
96
 
 
97
  model_types = ['ICON', 'PIFu', 'PaMIR']
98
+ examples_names = glob.glob('examples/*.png')
99
+ examples_types = np.random.choice(
100
+ model_types, len(examples_names), p=[0.6, 0.2, 0.2])
101
+
102
+ examples = [list(item) for item in zip(examples_names, examples_types)]
103
 
104
  with gr.Blocks() as demo:
105
  gr.Markdown(description)
 
122
 
123
  gr.Examples(examples=examples,
124
  inputs=[inp, radio_choice],
125
+ cache_examples=False,
126
  fn=generate_model,
127
  outputs=out_lst)
128
 
129
+ out_vid = gr.Video(
130
+ label="Image + Normal + SMPL Body + Clothed Human")
131
  out_vid_download = gr.File(
132
  label="Download Video, welcome share on Twitter with #ICON")
133
 
apps/infer.py CHANGED
@@ -458,7 +458,7 @@ def generate_model(in_path, model_type):
458
  del locals()[element]
459
  gc.collect()
460
  torch.cuda.empty_cache()
461
-
462
  return [smpl_glb_path, smpl_obj_path,smpl_npy_path,
463
  refine_glb_path, refine_obj_path,
464
  video_path, video_path, overlap_path]
 
458
  del locals()[element]
459
  gc.collect()
460
  torch.cuda.empty_cache()
461
+
462
  return [smpl_glb_path, smpl_obj_path,smpl_npy_path,
463
  refine_glb_path, refine_obj_path,
464
  video_path, video_path, overlap_path]