Update app.py
Browse files
app.py
CHANGED
|
@@ -240,12 +240,14 @@ def generate_splats_from_video(video_path, session_id=None):
|
|
| 240 |
session_id = uuid.uuid4().hex
|
| 241 |
|
| 242 |
images_folder, image_paths = extract_frames(video_path, session_id)
|
| 243 |
-
plyfile, rgb_vid, depth_vid = generate_splats_from_images(
|
| 244 |
|
| 245 |
return plyfile, rgb_vid, depth_vid, image_paths
|
| 246 |
|
| 247 |
@spaces.GPU()
|
| 248 |
-
def generate_splats_from_images(
|
|
|
|
|
|
|
| 249 |
|
| 250 |
if session_id is None:
|
| 251 |
session_id = uuid.uuid4().hex
|
|
@@ -256,13 +258,6 @@ def generate_splats_from_images(images_folder, session_id=None):
|
|
| 256 |
|
| 257 |
base_dir = os.path.join(os.environ["ANYSPLAT_PROCESSED"], session_id)
|
| 258 |
|
| 259 |
-
all_files = (
|
| 260 |
-
sorted(os.listdir(images_folder))
|
| 261 |
-
if os.path.isdir(images_folder)
|
| 262 |
-
else []
|
| 263 |
-
)
|
| 264 |
-
all_files = [f"{i}: {filename}" for i, filename in enumerate(all_files)]
|
| 265 |
-
|
| 266 |
print("Running run_model...")
|
| 267 |
with torch.no_grad():
|
| 268 |
plyfile, video, depth_colored = get_reconstructed_scene(base_dir, model, device)
|
|
@@ -413,7 +408,7 @@ if __name__ == "__main__":
|
|
| 413 |
|
| 414 |
submit_btn.click(
|
| 415 |
fn=generate_splats_from_images,
|
| 416 |
-
inputs=[
|
| 417 |
outputs=[reconstruction_output, rgb_video, depth_video])
|
| 418 |
|
| 419 |
input_video.upload(
|
|
|
|
| 240 |
session_id = uuid.uuid4().hex
|
| 241 |
|
| 242 |
images_folder, image_paths = extract_frames(video_path, session_id)
|
| 243 |
+
plyfile, rgb_vid, depth_vid = generate_splats_from_images(image_paths, session_id)
|
| 244 |
|
| 245 |
return plyfile, rgb_vid, depth_vid, image_paths
|
| 246 |
|
| 247 |
@spaces.GPU()
|
| 248 |
+
def generate_splats_from_images(image_paths, session_id=None):
|
| 249 |
+
|
| 250 |
+
print(image_paths)
|
| 251 |
|
| 252 |
if session_id is None:
|
| 253 |
session_id = uuid.uuid4().hex
|
|
|
|
| 258 |
|
| 259 |
base_dir = os.path.join(os.environ["ANYSPLAT_PROCESSED"], session_id)
|
| 260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
print("Running run_model...")
|
| 262 |
with torch.no_grad():
|
| 263 |
plyfile, video, depth_colored = get_reconstructed_scene(base_dir, model, device)
|
|
|
|
| 408 |
|
| 409 |
submit_btn.click(
|
| 410 |
fn=generate_splats_from_images,
|
| 411 |
+
inputs=[image_gallery, session_state],
|
| 412 |
outputs=[reconstruction_output, rgb_video, depth_video])
|
| 413 |
|
| 414 |
input_video.upload(
|