prrao87 commited on
Commit
138f5a5
·
verified ·
1 Parent(s): 916581f

Update README with LanceDB examples

Browse files
Files changed (1) hide show
  1. README.md +38 -0
README.md CHANGED
@@ -45,6 +45,44 @@ print("videos:", videos.count_rows())
45
  print("episodes:", episodes.count_rows())
46
  ```
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  ## Pull a video segment for one episode
49
 
50
  ```python
 
45
  print("episodes:", episodes.count_rows())
46
  ```
47
 
48
+ ## Load with LanceDB
49
+
50
+ These tables can also be consumed by [LanceDB](https://lancedb.github.io/lancedb/), the serverless vector database built on Lance, for simplified vector search and other queries. Each `.lance` file in `data/` is a table — open by name.
51
+
52
+ ```python
53
+ import lancedb
54
+
55
+ db = lancedb.connect("hf://datasets/lance-format/lerobot-pusht-lance/data")
56
+
57
+ frames = db.open_table("frames")
58
+ videos = db.open_table("videos")
59
+ episodes = db.open_table("episodes")
60
+
61
+ print("frames:", len(frames))
62
+ print("videos:", len(videos))
63
+ print("episodes:", len(episodes))
64
+ ```
65
+
66
+ ### LanceDB query example
67
+
68
+ ```python
69
+ import lancedb
70
+
71
+ db = lancedb.connect("hf://datasets/lance-format/lerobot-pusht-lance/data")
72
+ tbl = db.open_table("frames")
73
+
74
+ # Browse a few frames from the first episode
75
+ results = (
76
+ tbl.search()
77
+ .where("episode_index = 0")
78
+ .select(["episode_index", "frame_index", "timestamp"])
79
+ .limit(5)
80
+ .to_list()
81
+ )
82
+ for row in results:
83
+ print(row)
84
+ ```
85
+
86
  ## Pull a video segment for one episode
87
 
88
  ```python