kxic commited on
Commit
10ce721
·
verified ·
1 Parent(s): 4a5ed02

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. gradio_demo/gradio_demo.py +15 -17
  2. requirements.txt +1 -0
gradio_demo/gradio_demo.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import gradio as gr
2
  import os
3
  import shutil
@@ -111,7 +113,7 @@ pipeline.enable_vae_slicing()
111
 
112
 
113
 
114
-
115
  def run_eschernet(tmpdirname, eschernet_input_dict, sample_steps, sample_seed, nvs_num, nvs_mode):
116
  # set the random seed
117
  generator = torch.Generator(device=device).manual_seed(sample_seed)
@@ -212,6 +214,7 @@ def run_eschernet(tmpdirname, eschernet_input_dict, sample_steps, sample_seed, n
212
  return image, video_path
213
 
214
  # TODO mesh it
 
215
  def make3d():
216
  pass
217
 
@@ -284,7 +287,7 @@ def _convert_scene_output_to_glb(outdir, imgs, pts3d, mask, focals, cams2world,
284
  scene.export(file_obj=outfile)
285
  return outfile
286
 
287
-
288
  def get_3D_model_from_scene(outdir, silent, scene, min_conf_thr=3, as_pointcloud=False, mask_sky=False,
289
  clean_depth=False, transparent_cams=False, cam_size=0.05, same_focals=False):
290
  """
@@ -316,7 +319,7 @@ def get_3D_model_from_scene(outdir, silent, scene, min_conf_thr=3, as_pointcloud
316
  transparent_cams=transparent_cams, cam_size=cam_size, silent=silent,
317
  same_focals=same_focals)
318
 
319
-
320
  def get_reconstructed_scene(outdir, model, device, silent, image_size, filelist, schedule, niter, min_conf_thr,
321
  as_pointcloud, mask_sky, clean_depth, transparent_cams, cam_size,
322
  scenegraph_type, winsize, refid, same_focals):
@@ -567,20 +570,15 @@ def main():
567
  run_dust3r = gr.Button("Get Pose!", elem_id="dust3r")
568
  with gr.Row():
569
  processed_image = gr.Gallery(label='rgb,rgba', columns=2, height="100%")
570
-
571
-
572
-
573
-
574
-
575
- # with gr.Row(variant="panel"):
576
- # gr.Examples(
577
- # examples=[
578
- # os.path.join("examples/hairdryer", img_name) for img_name in sorted(os.listdir("examples/hairdryer"))
579
- # ],
580
- # inputs=[input_image],
581
- # label="Examples",
582
- # examples_per_page=20
583
- # )
584
 
585
  # right column
586
  with gr.Column():
 
1
+ import spaces
2
+
3
  import gradio as gr
4
  import os
5
  import shutil
 
113
 
114
 
115
 
116
+ @spaces.GPU(duration=120)
117
  def run_eschernet(tmpdirname, eschernet_input_dict, sample_steps, sample_seed, nvs_num, nvs_mode):
118
  # set the random seed
119
  generator = torch.Generator(device=device).manual_seed(sample_seed)
 
214
  return image, video_path
215
 
216
  # TODO mesh it
217
+ @spaces.GPU(duration=120)
218
  def make3d():
219
  pass
220
 
 
287
  scene.export(file_obj=outfile)
288
  return outfile
289
 
290
+ @spaces.GPU(duration=120)
291
  def get_3D_model_from_scene(outdir, silent, scene, min_conf_thr=3, as_pointcloud=False, mask_sky=False,
292
  clean_depth=False, transparent_cams=False, cam_size=0.05, same_focals=False):
293
  """
 
319
  transparent_cams=transparent_cams, cam_size=cam_size, silent=silent,
320
  same_focals=same_focals)
321
 
322
+ @spaces.GPU(duration=120)
323
  def get_reconstructed_scene(outdir, model, device, silent, image_size, filelist, schedule, niter, min_conf_thr,
324
  as_pointcloud, mask_sky, clean_depth, transparent_cams, cam_size,
325
  scenegraph_type, winsize, refid, same_focals):
 
570
  run_dust3r = gr.Button("Get Pose!", elem_id="dust3r")
571
  with gr.Row():
572
  processed_image = gr.Gallery(label='rgb,rgba', columns=2, height="100%")
573
+ with gr.Row(variant="panel"):
574
+ gr.Examples(
575
+ examples=[
576
+ os.path.join("examples/hairdryer", img_name) for img_name in sorted(os.listdir("examples/hairdryer"))
577
+ ],
578
+ inputs=[input_image],
579
+ label="Examples",
580
+ examples_per_page=20
581
+ )
 
 
 
 
 
582
 
583
  # right column
584
  with gr.Column():
requirements.txt CHANGED
@@ -270,3 +270,4 @@ xformers>=0.0.19
270
  xxhash==3.2.0
271
  yarl==1.9.2
272
  zipp==3.16.2
 
 
270
  xxhash==3.2.0
271
  yarl==1.9.2
272
  zipp==3.16.2
273
+ spaces