Chao Xu commited on
Commit
aa2ac84
โ€ข
1 Parent(s): 7d7aedf

update demo images

Browse files
app.py CHANGED
@@ -5,7 +5,8 @@ python gradio_new.py 0
5
  '''
6
  import os, sys
7
  from huggingface_hub import snapshot_download
8
- code_dir = snapshot_download("One-2-3-45/code", token=os.environ['TOKEN'])
 
9
  sys.path.append(code_dir)
10
 
11
  elev_est_dir = os.path.join(code_dir, "one2345_elev_est/")
@@ -451,6 +452,7 @@ def on_coords_slider(image, x_min, y_min, x_max, y_max, color=(88, 191, 131, 255
451
  print("on_coords_slider, image_size:", np.array(image).shape)
452
  image = cv2.cvtColor(np.array(image), cv2.COLOR_RGBA2BGRA)
453
  image = cv2.rectangle(image, (x_min, y_min), (x_max, y_max), color, int(max(max(image.shape) / 400*2, 2)))
 
454
  return cv2.cvtColor(image, cv2.COLOR_BGRA2RGBA) # image[:, :, ::-1]
455
 
456
  def save_img(image):
@@ -638,7 +640,7 @@ def run_demo(
638
  def refresh(tmp_dir):
639
  if os.path.exists(tmp_dir):
640
  shutil.rmtree(tmp_dir)
641
- tmp_dir = tempfile.TemporaryDirectory(dir="./demo_tmp")
642
  print("create tmp_dir", tmp_dir.name)
643
  clear = [gr.update(value=[])] + [None] * 6 + [gr.update(visible=False)] * 2 + [None] * 8 + [gr.update(value=False)] * 8
644
  return (tmp_dir.name, *clear)
 
5
  '''
6
  import os, sys
7
  from huggingface_hub import snapshot_download
8
+ # code_dir = snapshot_download("One-2-3-45/code", token=os.environ['TOKEN'])
9
+ code_dir = "../code"
10
  sys.path.append(code_dir)
11
 
12
  elev_est_dir = os.path.join(code_dir, "one2345_elev_est/")
 
452
  print("on_coords_slider, image_size:", np.array(image).shape)
453
  image = cv2.cvtColor(np.array(image), cv2.COLOR_RGBA2BGRA)
454
  image = cv2.rectangle(image, (x_min, y_min), (x_max, y_max), color, int(max(max(image.shape) / 400*2, 2)))
455
+ print("on_coords_slider, done")
456
  return cv2.cvtColor(image, cv2.COLOR_BGRA2RGBA) # image[:, :, ::-1]
457
 
458
  def save_img(image):
 
640
  def refresh(tmp_dir):
641
  if os.path.exists(tmp_dir):
642
  shutil.rmtree(tmp_dir)
643
+ tmp_dir = tempfile.TemporaryDirectory(dir=os.path.join(os.path.dirname(__file__), 'demo_tmp'))
644
  print("create tmp_dir", tmp_dir.name)
645
  clear = [gr.update(value=[])] + [None] * 6 + [gr.update(visible=False)] * 2 + [None] * 8 + [gr.update(value=False)] * 8
646
  return (tmp_dir.name, *clear)
demo_examples/01_backpack.png ADDED
demo_examples/02_hydrant.png ADDED
demo_examples/04_robocat.png ADDED
demo_examples/05_clock.png ADDED
demo_examples/06_kungfucat.png ADDED
demo_examples/07_goose_chef.png ADDED
demo_examples/08_broccoli.png ADDED
demo_examples/09_pineapple_bottle.png ADDED
demo_examples/10_chocolatecake.png ADDED
demo_examples/11_extinguisher.png ADDED
requirements.txt CHANGED
@@ -59,6 +59,7 @@ zarr
59
  sapien
60
  pyglet==1.5.27
61
  wis3d
 
62
  git+https://github.com/NVlabs/nvdiffrast.git
63
  # shap-e
64
  git+https://github.com/openai/shap-e@8625e7c
 
59
  sapien
60
  pyglet==1.5.27
61
  wis3d
62
+ gdown
63
  git+https://github.com/NVlabs/nvdiffrast.git
64
  # shap-e
65
  git+https://github.com/openai/shap-e@8625e7c