Spaces:
Runtime error
Runtime error
Jacob Petterle commited on
Commit ·
0810c7b
1
Parent(s): 9d42c25
update
Browse files
taai_demo/plugin/yt_transcript_chunker.py
CHANGED
|
@@ -20,9 +20,7 @@ def get_yt_transcript_chunks(url, max_length=500) -> Sequence[SemanticSnippet]:
|
|
| 20 |
current_chunk.pop()
|
| 21 |
chunk = " ".join(map(lambda x: x["text"], current_chunk))
|
| 22 |
metadata = {
|
| 23 |
-
"
|
| 24 |
-
"end": current_chunk[-1]["end"],
|
| 25 |
-
"video_id": query["v"][0],
|
| 26 |
}
|
| 27 |
chunks.append(SemanticSnippet(text=chunk, metadata=metadata))
|
| 28 |
current_chunk = [current_chunk[-1], snippet]
|
|
|
|
| 20 |
current_chunk.pop()
|
| 21 |
chunk = " ".join(map(lambda x: x["text"], current_chunk))
|
| 22 |
metadata = {
|
| 23 |
+
"url": f"https://www.youtube.com/watch?v={query['v'][0]}&t={current_chunk[0]['start']}s",
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
chunks.append(SemanticSnippet(text=chunk, metadata=metadata))
|
| 26 |
current_chunk = [current_chunk[-1], snippet]
|