Update app.py
Browse files
app.py
CHANGED
@@ -20,16 +20,12 @@ from smolagents import Tool
|
|
20 |
from youtube_transcript_api import YouTubeTranscriptApi
|
21 |
import re
|
22 |
|
23 |
-
from smolagents import Tool
|
24 |
-
|
25 |
-
from smolagents import Tool
|
26 |
-
|
27 |
class YouTubeTranscriptTool(Tool):
|
28 |
name = "youtube_transcript"
|
29 |
description = "Extracts transcript text from a YouTube video URL"
|
30 |
-
inputs = {"url": str}
|
31 |
-
outputs = {"transcript": str}
|
32 |
-
output_type = dict # ✅
|
33 |
|
34 |
def __call__(self, url: str) -> dict:
|
35 |
from youtube_transcript_api import YouTubeTranscriptApi
|
@@ -38,6 +34,8 @@ class YouTubeTranscriptTool(Tool):
|
|
38 |
transcript_text = " ".join([t["text"] for t in transcript_list])
|
39 |
return {"transcript": transcript_text}
|
40 |
|
|
|
|
|
41 |
transcript_tool = YouTubeTranscriptTool()
|
42 |
|
43 |
async def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
|
20 |
from youtube_transcript_api import YouTubeTranscriptApi
|
21 |
import re
|
22 |
|
|
|
|
|
|
|
|
|
23 |
class YouTubeTranscriptTool(Tool):
|
24 |
name = "youtube_transcript"
|
25 |
description = "Extracts transcript text from a YouTube video URL"
|
26 |
+
inputs = {"url": "str"} # 🟢 Type as a string
|
27 |
+
outputs = {"transcript": "str"} # 🟢 Type as a string
|
28 |
+
output_type = "dict" # ✅ Fix: type must be a *string*, not a Python class
|
29 |
|
30 |
def __call__(self, url: str) -> dict:
|
31 |
from youtube_transcript_api import YouTubeTranscriptApi
|
|
|
34 |
transcript_text = " ".join([t["text"] for t in transcript_list])
|
35 |
return {"transcript": transcript_text}
|
36 |
|
37 |
+
|
38 |
+
|
39 |
transcript_tool = YouTubeTranscriptTool()
|
40 |
|
41 |
async def run_and_submit_all(profile: gr.OAuthProfile | None):
|