Spaces:
Runtime error
Runtime error
Added class for transcriptions
Browse files- tools/transcription_tool.py +13 -0
tools/transcription_tool.py
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from youtube_transcript_api import YouTubeTranscriptApi
|
| 2 |
+
from smolagents.tools import Tool
|
| 3 |
+
|
| 4 |
+
class YoutubeTranscriptions(Tool):
|
| 5 |
+
name = "Transcription Generator"
|
| 6 |
+
description = "Generates transcription for a youtube video and summarizes them. "
|
| 7 |
+
inputs = {'query': {'type': 'string', 'description': ' URL of the video to transcribe'}}
|
| 8 |
+
output_type = "string"
|
| 9 |
+
def forward(self, URL: str) -> str:
|
| 10 |
+
transcription = YouTubeTranscriptApi.get_transcript(URL)
|
| 11 |
+
if transcription:
|
| 12 |
+
return transcription
|
| 13 |
+
return "Sorry. the transcription was not available"
|