aliangdw commited on
Commit
47bd4bf
·
1 Parent(s): 2296996
Files changed (1) hide show
  1. app.py +8 -8
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 (datasets.Audio object with bytes)
40
  frames_data = item["frames"]
41
 
42
- # Extract video bytes from datasets.Audio object
43
- if hasattr(frames_data, 'bytes') and frames_data["bytes"] is not None:
44
- video_bytes = frames_data["bytes"]
45
- frames_info = f"Video bytes: {len(video_bytes)} bytes"
46
  else:
47
- return None, "Error: No video bytes found", "Error: No video bytes found", None
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 bytes for Gradio to display
67
- return video_bytes, metadata, f"Trajectory {index}", None
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