init project
Browse files
app.py
CHANGED
@@ -447,7 +447,7 @@ def get_3D_model_from_scene(outdir, scene, min_conf_thr=3, as_pointcloud=False,
|
|
447 |
# return cog_seg_maps, rev_cog_seg_maps, multi_view_clip_feats
|
448 |
|
449 |
|
450 |
-
@spaces.GPU(duration=30)
|
451 |
def get_reconstructed_scene(outdir, filelist, schedule='linear', niter=300, min_conf_thr=3.0,
|
452 |
as_pointcloud=True, mask_sky=False, clean_depth=True, transparent_cams=True, cam_size=0.05,
|
453 |
scenegraph_type='complete', winsize=1, refid=0):
|
@@ -537,11 +537,15 @@ def get_reconstructed_scene(outdir, filelist, schedule='linear', niter=300, min_
|
|
537 |
outfile = get_3D_model_from_scene(outdir, scene, min_conf_thr, as_pointcloud, mask_sky,
|
538 |
clean_depth, transparent_cams, cam_size)
|
539 |
|
540 |
-
scene.to('cpu')
|
|
|
|
|
|
|
|
|
541 |
torch.cuda.empty_cache()
|
542 |
-
return
|
543 |
|
544 |
-
# @spaces.GPU(duration=30)
|
545 |
# def get_3D_object_from_scene(outdir, text, threshold, scene, min_conf_thr, as_pointcloud,
|
546 |
# mask_sky, clean_depth, transparent_cams, cam_size):
|
547 |
|
@@ -569,7 +573,8 @@ recon_fun = functools.partial(get_reconstructed_scene, tmpdirname)
|
|
569 |
|
570 |
with gradio.Blocks(css=""".gradio-container {margin: 0 !important; min-width: 100%};""", title="PE3R Demo") as demo:
|
571 |
# scene state is save so that you can change conf_thr, cam_size... without rerunning the inference
|
572 |
-
scene = gradio.State(None)
|
|
|
573 |
gradio.HTML('<h2 style="text-align: center;">PE3R Demo</h2>')
|
574 |
with gradio.Column():
|
575 |
inputfiles = gradio.File(file_count="multiple")
|
@@ -587,7 +592,7 @@ with gradio.Blocks(css=""".gradio-container {margin: 0 !important; min-width: 10
|
|
587 |
|
588 |
run_btn.click(fn=recon_fun,
|
589 |
inputs=[inputfiles],
|
590 |
-
outputs=[
|
591 |
|
592 |
# find_btn.click(fn=get_3D_object_from_scene_fun,
|
593 |
# inputs=[text_input, threshold, scene, min_conf_thr, as_pointcloud, mask_sky,
|
|
|
447 |
# return cog_seg_maps, rev_cog_seg_maps, multi_view_clip_feats
|
448 |
|
449 |
|
450 |
+
@spaces.GPU#(duration=30)
|
451 |
def get_reconstructed_scene(outdir, filelist, schedule='linear', niter=300, min_conf_thr=3.0,
|
452 |
as_pointcloud=True, mask_sky=False, clean_depth=True, transparent_cams=True, cam_size=0.05,
|
453 |
scenegraph_type='complete', winsize=1, refid=0):
|
|
|
537 |
outfile = get_3D_model_from_scene(outdir, scene, min_conf_thr, as_pointcloud, mask_sky,
|
538 |
clean_depth, transparent_cams, cam_size)
|
539 |
|
540 |
+
# scene.to('cpu')
|
541 |
+
# print(scene)
|
542 |
+
# print(scene.imgs)
|
543 |
+
# print(scene.cogs) scene,
|
544 |
+
|
545 |
torch.cuda.empty_cache()
|
546 |
+
return outfile
|
547 |
|
548 |
+
# @spaces.GPU #(duration=30)
|
549 |
# def get_3D_object_from_scene(outdir, text, threshold, scene, min_conf_thr, as_pointcloud,
|
550 |
# mask_sky, clean_depth, transparent_cams, cam_size):
|
551 |
|
|
|
573 |
|
574 |
with gradio.Blocks(css=""".gradio-container {margin: 0 !important; min-width: 100%};""", title="PE3R Demo") as demo:
|
575 |
# scene state is save so that you can change conf_thr, cam_size... without rerunning the inference
|
576 |
+
# scene = gradio.State(None)
|
577 |
+
|
578 |
gradio.HTML('<h2 style="text-align: center;">PE3R Demo</h2>')
|
579 |
with gradio.Column():
|
580 |
inputfiles = gradio.File(file_count="multiple")
|
|
|
592 |
|
593 |
run_btn.click(fn=recon_fun,
|
594 |
inputs=[inputfiles],
|
595 |
+
outputs=[outmodel]) # , outgallery, scene,
|
596 |
|
597 |
# find_btn.click(fn=get_3D_object_from_scene_fun,
|
598 |
# inputs=[text_input, threshold, scene, min_conf_thr, as_pointcloud, mask_sky,
|