Update app.py
Browse files
app.py
CHANGED
@@ -15,53 +15,13 @@ login(token=os.environ["HUGGINGFACEHUB_API_TOKEN"])
|
|
15 |
## TOOL 1
|
16 |
search_tool = DuckDuckGoSearchTool()
|
17 |
|
18 |
-
## TOOL 2
|
19 |
-
from smolagents import Tool
|
20 |
-
from youtube_transcript_api import YouTubeTranscriptApi
|
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 |
-
|
30 |
-
from smolagents import Tool
|
31 |
-
from youtube_transcript_api import YouTubeTranscriptApi
|
32 |
-
|
33 |
-
class YouTubeTranscriptTool(Tool):
|
34 |
-
name = "youtube_transcript"
|
35 |
-
description = "Extracts transcript text from a YouTube video URL"
|
36 |
-
|
37 |
-
inputs = {
|
38 |
-
"url": {
|
39 |
-
"type": "string",
|
40 |
-
"description": "YouTube video URL"
|
41 |
-
}
|
42 |
-
}
|
43 |
-
outputs = {
|
44 |
-
"transcript": {
|
45 |
-
"type": "string",
|
46 |
-
"description": "Transcript text from the video"
|
47 |
-
}
|
48 |
-
}
|
49 |
-
output_type = "object"
|
50 |
-
|
51 |
-
def __call__(self, url: str) -> dict:
|
52 |
-
video_id = url.split("v=")[-1].split("&")[0]
|
53 |
-
transcript_list = YouTubeTranscriptApi.get_transcript(video_id)
|
54 |
-
transcript_text = " ".join([t["text"] for t in transcript_list])
|
55 |
-
return {"transcript": transcript_text}
|
56 |
-
|
57 |
-
transcript_tool = YouTubeTranscriptTool()
|
58 |
|
59 |
async def run_and_submit_all(profile: gr.OAuthProfile | None):
|
60 |
log_output = ""
|
61 |
|
62 |
try:
|
63 |
agent = ToolCallingAgent(
|
64 |
-
tools=[search_tool
|
65 |
model=InferenceClientModel(model="deepseek-ai/DeepSeek-V3", provider="together"),
|
66 |
max_steps=15,
|
67 |
verbosity_level=0,
|
|
|
15 |
## TOOL 1
|
16 |
search_tool = DuckDuckGoSearchTool()
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
async def run_and_submit_all(profile: gr.OAuthProfile | None):
|
20 |
log_output = ""
|
21 |
|
22 |
try:
|
23 |
agent = ToolCallingAgent(
|
24 |
+
tools=[search_tool],
|
25 |
model=InferenceClientModel(model="deepseek-ai/DeepSeek-V3", provider="together"),
|
26 |
max_steps=15,
|
27 |
verbosity_level=0,
|