Update app.py
Browse files
app.py
CHANGED
|
@@ -223,7 +223,7 @@ def update_gallery_on_video_upload(input_video, session_id):
|
|
| 223 |
return None, None, None
|
| 224 |
|
| 225 |
target_dir, image_paths = extract_frames(input_video, session_id)
|
| 226 |
-
return None, target_dir, image_paths
|
| 227 |
|
| 228 |
def update_gallery_on_images_upload(input_images, session_id):
|
| 229 |
|
|
@@ -231,7 +231,7 @@ def update_gallery_on_images_upload(input_images, session_id):
|
|
| 231 |
return None, None, None
|
| 232 |
|
| 233 |
target_dir, image_paths = extract_images(input_images, session_id)
|
| 234 |
-
return None, target_dir, image_paths
|
| 235 |
|
| 236 |
@spaces.GPU()
|
| 237 |
def generate_splats_from_video(video_path, session_id=None):
|
|
@@ -247,6 +247,14 @@ def generate_splats_from_video(video_path, session_id=None):
|
|
| 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:
|
|
@@ -408,19 +416,19 @@ if __name__ == "__main__":
|
|
| 408 |
|
| 409 |
submit_btn.click(
|
| 410 |
fn=generate_splats_from_images,
|
| 411 |
-
inputs=[
|
| 412 |
outputs=[reconstruction_output, rgb_video, depth_video])
|
| 413 |
|
| 414 |
input_video.upload(
|
| 415 |
fn=update_gallery_on_video_upload,
|
| 416 |
inputs=[input_video, session_state],
|
| 417 |
-
outputs=[reconstruction_output, target_dir_output, image_gallery
|
| 418 |
)
|
| 419 |
|
| 420 |
input_images.upload(
|
| 421 |
fn=update_gallery_on_images_upload,
|
| 422 |
inputs=[input_images, session_state],
|
| 423 |
-
outputs=[reconstruction_output, target_dir_output, image_gallery
|
| 424 |
)
|
| 425 |
|
| 426 |
demo.unload(cleanup)
|
|
|
|
| 223 |
return None, None, None
|
| 224 |
|
| 225 |
target_dir, image_paths = extract_frames(input_video, session_id)
|
| 226 |
+
return None, target_dir, image_paths
|
| 227 |
|
| 228 |
def update_gallery_on_images_upload(input_images, session_id):
|
| 229 |
|
|
|
|
| 231 |
return None, None, None
|
| 232 |
|
| 233 |
target_dir, image_paths = extract_images(input_images, session_id)
|
| 234 |
+
return None, target_dir, image_paths
|
| 235 |
|
| 236 |
@spaces.GPU()
|
| 237 |
def generate_splats_from_video(video_path, session_id=None):
|
|
|
|
| 247 |
@spaces.GPU()
|
| 248 |
def generate_splats_from_images(image_paths, session_id=None):
|
| 249 |
|
| 250 |
+
processed_image_paths = []
|
| 251 |
+
|
| 252 |
+
for file_data in image_paths:
|
| 253 |
+
if isinstance(file_data, tuple):
|
| 254 |
+
file_path, _ = file_data
|
| 255 |
+
processed_image_paths.append(file_path)
|
| 256 |
+
|
| 257 |
+
image_paths = processed_image_paths
|
| 258 |
print(image_paths)
|
| 259 |
|
| 260 |
if session_id is None:
|
|
|
|
| 416 |
|
| 417 |
submit_btn.click(
|
| 418 |
fn=generate_splats_from_images,
|
| 419 |
+
inputs=[image_gallery, session_state],
|
| 420 |
outputs=[reconstruction_output, rgb_video, depth_video])
|
| 421 |
|
| 422 |
input_video.upload(
|
| 423 |
fn=update_gallery_on_video_upload,
|
| 424 |
inputs=[input_video, session_state],
|
| 425 |
+
outputs=[reconstruction_output, target_dir_output, image_gallery],
|
| 426 |
)
|
| 427 |
|
| 428 |
input_images.upload(
|
| 429 |
fn=update_gallery_on_images_upload,
|
| 430 |
inputs=[input_images, session_state],
|
| 431 |
+
outputs=[reconstruction_output, target_dir_output, image_gallery],
|
| 432 |
)
|
| 433 |
|
| 434 |
demo.unload(cleanup)
|