Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,9 @@ from youtube_transcript_api import YouTubeTranscriptApi
|
|
21 |
import re
|
22 |
|
23 |
|
|
|
|
|
|
|
24 |
from smolagents import Tool
|
25 |
from youtube_transcript_api import YouTubeTranscriptApi
|
26 |
|
@@ -30,17 +33,17 @@ class YouTubeTranscriptTool(Tool):
|
|
30 |
|
31 |
inputs = {
|
32 |
"url": {
|
33 |
-
"type": "string",
|
34 |
"description": "YouTube video URL"
|
35 |
}
|
36 |
}
|
37 |
outputs = {
|
38 |
"transcript": {
|
39 |
-
"type": "string",
|
40 |
"description": "Transcript text from the video"
|
41 |
}
|
42 |
}
|
43 |
-
output_type = "
|
44 |
|
45 |
def __call__(self, url: str) -> dict:
|
46 |
video_id = url.split("v=")[-1].split("&")[0]
|
@@ -48,9 +51,6 @@ class YouTubeTranscriptTool(Tool):
|
|
48 |
transcript_text = " ".join([t["text"] for t in transcript_list])
|
49 |
return {"transcript": transcript_text}
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
transcript_tool = YouTubeTranscriptTool()
|
55 |
|
56 |
async def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
|
21 |
import re
|
22 |
|
23 |
|
24 |
+
from smolagents import Tool
|
25 |
+
from youtube_transcript_api import YouTubeTranscriptApi
|
26 |
+
|
27 |
from smolagents import Tool
|
28 |
from youtube_transcript_api import YouTubeTranscriptApi
|
29 |
|
|
|
33 |
|
34 |
inputs = {
|
35 |
"url": {
|
36 |
+
"type": "string",
|
37 |
"description": "YouTube video URL"
|
38 |
}
|
39 |
}
|
40 |
outputs = {
|
41 |
"transcript": {
|
42 |
+
"type": "string",
|
43 |
"description": "Transcript text from the video"
|
44 |
}
|
45 |
}
|
46 |
+
output_type = "object" # ✅ FIXED: 'object' is a valid OpenAPI type
|
47 |
|
48 |
def __call__(self, url: str) -> dict:
|
49 |
video_id = url.split("v=")[-1].split("&")[0]
|
|
|
51 |
transcript_text = " ".join([t["text"] for t in transcript_list])
|
52 |
return {"transcript": transcript_text}
|
53 |
|
|
|
|
|
|
|
54 |
transcript_tool = YouTubeTranscriptTool()
|
55 |
|
56 |
async def run_and_submit_all(profile: gr.OAuthProfile | None):
|