init project
Browse files
app.py
CHANGED
@@ -521,25 +521,25 @@ def get_reconstructed_scene(outdir, filelist, schedule, niter, min_conf_thr,
|
|
521 |
# imgs.append(rgb(depths[i]))
|
522 |
# imgs.append(rgb(confs[i]))
|
523 |
|
524 |
-
return scene, outfile#, imgs
|
525 |
|
526 |
-
@spaces.GPU(duration=180)
|
527 |
-
def get_3D_object_from_scene(outdir, text, threshold, scene, min_conf_thr, as_pointcloud,
|
528 |
-
|
529 |
|
530 |
-
|
531 |
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
|
544 |
|
545 |
def set_scenegraph_options(inputfiles, winsize, refid, scenegraph_type):
|
@@ -566,7 +566,7 @@ def set_scenegraph_options(inputfiles, winsize, refid, scenegraph_type):
|
|
566 |
with tempfile.TemporaryDirectory(suffix='pe3r_gradio_demo') as tmpdirname:
|
567 |
recon_fun = functools.partial(get_reconstructed_scene, tmpdirname)
|
568 |
# model_from_scene_fun = functools.partial(get_3D_model_from_scene, tmpdirname)
|
569 |
-
get_3D_object_from_scene_fun = functools.partial(get_3D_object_from_scene, tmpdirname)
|
570 |
|
571 |
with gradio.Blocks(css=""".gradio-container {margin: 0 !important; min-width: 100%};""", title="PE3R Demo") as demo:
|
572 |
# scene state is save so that you can change conf_thr, cam_size... without rerunning the inference
|
@@ -652,8 +652,8 @@ with tempfile.TemporaryDirectory(suffix='pe3r_gradio_demo') as tmpdirname:
|
|
652 |
# inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
653 |
# clean_depth, transparent_cams, cam_size],
|
654 |
# outputs=outmodel)
|
655 |
-
find_btn.click(fn=get_3D_object_from_scene_fun,
|
656 |
-
|
657 |
-
|
658 |
-
|
659 |
demo.launch(show_error=True, share=None, server_name=None, server_port=None)
|
|
|
521 |
# imgs.append(rgb(depths[i]))
|
522 |
# imgs.append(rgb(confs[i]))
|
523 |
|
524 |
+
return scene, outfile #, imgs
|
525 |
|
526 |
+
# @spaces.GPU(duration=180)
|
527 |
+
# def get_3D_object_from_scene(outdir, text, threshold, scene, min_conf_thr, as_pointcloud,
|
528 |
+
# mask_sky, clean_depth, transparent_cams, cam_size):
|
529 |
|
530 |
+
# device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
531 |
|
532 |
+
# texts = [text]
|
533 |
+
# inputs = pe3r.siglip_tokenizer(text=texts, padding="max_length", return_tensors="pt")
|
534 |
+
# inputs = {key: value.to(device) for key, value in inputs.items()}
|
535 |
+
# with torch.no_grad():
|
536 |
+
# text_feats =pe3r.siglip.get_text_features(**inputs)
|
537 |
+
# text_feats = text_feats / text_feats.norm(dim=-1, keepdim=True)
|
538 |
+
# scene.render_image(text_feats, threshold)
|
539 |
+
# scene.ori_imgs = scene.rendered_imgs
|
540 |
+
# outfile = get_3D_model_from_scene(outdir, scene, min_conf_thr, as_pointcloud, mask_sky,
|
541 |
+
# clean_depth, transparent_cams, cam_size)
|
542 |
+
# return outfile
|
543 |
|
544 |
|
545 |
def set_scenegraph_options(inputfiles, winsize, refid, scenegraph_type):
|
|
|
566 |
with tempfile.TemporaryDirectory(suffix='pe3r_gradio_demo') as tmpdirname:
|
567 |
recon_fun = functools.partial(get_reconstructed_scene, tmpdirname)
|
568 |
# model_from_scene_fun = functools.partial(get_3D_model_from_scene, tmpdirname)
|
569 |
+
# get_3D_object_from_scene_fun = functools.partial(get_3D_object_from_scene, tmpdirname)
|
570 |
|
571 |
with gradio.Blocks(css=""".gradio-container {margin: 0 !important; min-width: 100%};""", title="PE3R Demo") as demo:
|
572 |
# scene state is save so that you can change conf_thr, cam_size... without rerunning the inference
|
|
|
652 |
# inputs=[scene, min_conf_thr, as_pointcloud, mask_sky,
|
653 |
# clean_depth, transparent_cams, cam_size],
|
654 |
# outputs=outmodel)
|
655 |
+
# find_btn.click(fn=get_3D_object_from_scene_fun,
|
656 |
+
# inputs=[text_input, threshold, scene, min_conf_thr, as_pointcloud, mask_sky,
|
657 |
+
# clean_depth, transparent_cams, cam_size],
|
658 |
+
# outputs=outmodel)
|
659 |
demo.launch(show_error=True, share=None, server_name=None, server_port=None)
|