Update app.py
Browse files
app.py
CHANGED
|
@@ -27,6 +27,7 @@ from src.misc.image_io import save_interpolated_video
|
|
| 27 |
from src.model.model.anysplat import AnySplat
|
| 28 |
from src.model.ply_export import export_ply
|
| 29 |
from src.utils.image import process_image
|
|
|
|
| 30 |
|
| 31 |
os.environ["ANYSPLAT_PROCESSED"] = f"{os.getcwd()}/proprocess_results"
|
| 32 |
|
|
@@ -63,6 +64,8 @@ def get_reconstructed_scene(outdir, model, device):
|
|
| 63 |
)
|
| 64 |
|
| 65 |
plyfile = os.path.join(outdir, "gaussians.ply")
|
|
|
|
|
|
|
| 66 |
export_ply(
|
| 67 |
gaussians.means[0],
|
| 68 |
gaussians.scales[0],
|
|
@@ -73,9 +76,13 @@ def get_reconstructed_scene(outdir, model, device):
|
|
| 73 |
save_sh_dc_only=True,
|
| 74 |
)
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
# Clean up
|
| 77 |
torch.cuda.empty_cache()
|
| 78 |
-
return
|
| 79 |
|
| 80 |
|
| 81 |
# 2) Handle uploaded video/images --> produce target_dir + images
|
|
|
|
| 27 |
from src.model.model.anysplat import AnySplat
|
| 28 |
from src.model.ply_export import export_ply
|
| 29 |
from src.utils.image import process_image
|
| 30 |
+
import trimesh
|
| 31 |
|
| 32 |
os.environ["ANYSPLAT_PROCESSED"] = f"{os.getcwd()}/proprocess_results"
|
| 33 |
|
|
|
|
| 64 |
)
|
| 65 |
|
| 66 |
plyfile = os.path.join(outdir, "gaussians.ply")
|
| 67 |
+
glbfile = os.path.join(outdir, "gaussians.glb")
|
| 68 |
+
|
| 69 |
export_ply(
|
| 70 |
gaussians.means[0],
|
| 71 |
gaussians.scales[0],
|
|
|
|
| 76 |
save_sh_dc_only=True,
|
| 77 |
)
|
| 78 |
|
| 79 |
+
|
| 80 |
+
mesh = trimesh.load(plyfile)
|
| 81 |
+
mesh.export(glbfile)
|
| 82 |
+
|
| 83 |
# Clean up
|
| 84 |
torch.cuda.empty_cache()
|
| 85 |
+
return glbfile, video, depth_colored
|
| 86 |
|
| 87 |
|
| 88 |
# 2) Handle uploaded video/images --> produce target_dir + images
|