Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
|
@@ -36,15 +36,15 @@ def visualize_trajectory(dataset, index):
|
|
| 36 |
is_robot = item["is_robot"]
|
| 37 |
data_source = item["data_source"]
|
| 38 |
|
| 39 |
-
# Get the frames data (
|
| 40 |
frames_data = item["frames"]
|
| 41 |
|
| 42 |
-
#
|
| 43 |
-
if
|
| 44 |
-
|
| 45 |
-
frames_info = f"Video
|
| 46 |
else:
|
| 47 |
-
return None, "Error:
|
| 48 |
|
| 49 |
# Create metadata
|
| 50 |
metadata = f"""
|
|
@@ -63,8 +63,8 @@ def visualize_trajectory(dataset, index):
|
|
| 63 |
**Trajectory ID:** {item.get('id', 'N/A')}
|
| 64 |
"""
|
| 65 |
|
| 66 |
-
# Return video
|
| 67 |
-
return
|
| 68 |
|
| 69 |
except Exception as e:
|
| 70 |
return None, f"Error: {str(e)}", f"Error: {str(e)}", None
|
|
|
|
| 36 |
is_robot = item["is_robot"]
|
| 37 |
data_source = item["data_source"]
|
| 38 |
|
| 39 |
+
# Get the frames data (video file path)
|
| 40 |
frames_data = item["frames"]
|
| 41 |
|
| 42 |
+
# Handle video file path (could be local path or HuggingFace Hub URL)
|
| 43 |
+
if isinstance(frames_data, str):
|
| 44 |
+
video_path = frames_data
|
| 45 |
+
frames_info = f"Video file: {video_path}"
|
| 46 |
else:
|
| 47 |
+
return None, "Error: Invalid video path", "Error: Invalid video path", None
|
| 48 |
|
| 49 |
# Create metadata
|
| 50 |
metadata = f"""
|
|
|
|
| 63 |
**Trajectory ID:** {item.get('id', 'N/A')}
|
| 64 |
"""
|
| 65 |
|
| 66 |
+
# Return video path for Gradio to display
|
| 67 |
+
return video_path, metadata, f"Trajectory {index}", None
|
| 68 |
|
| 69 |
except Exception as e:
|
| 70 |
return None, f"Error: {str(e)}", f"Error: {str(e)}", None
|