Spaces:
Sleeping
Sleeping
Update ToolSet.py
Browse files- ToolSet.py +4 -5
ToolSet.py
CHANGED
@@ -6,7 +6,7 @@ from langchain_experimental.utilities import PythonREPL
|
|
6 |
import cv2
|
7 |
from pathlib import Path
|
8 |
from yt_dlp import YoutubeDL
|
9 |
-
from ultralytics import YOLO
|
10 |
from typing import List, Dict
|
11 |
from typing import TypedDict, Annotated
|
12 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
@@ -16,10 +16,6 @@ from langchain.tools import Tool, tool
|
|
16 |
from utils import GaiaClient
|
17 |
|
18 |
|
19 |
-
DOWNLOAD_PATH = Path("questions")
|
20 |
-
DOWNLOAD_PATH.mkdir(exist_ok=True)
|
21 |
-
|
22 |
-
|
23 |
@tool
|
24 |
def download_file(task_id: str, filename: str) -> str:
|
25 |
"""
|
@@ -28,6 +24,8 @@ def download_file(task_id: str, filename: str) -> str:
|
|
28 |
task_id: The id of the task to download a related file.
|
29 |
filename: Path to store the file to.
|
30 |
"""
|
|
|
|
|
31 |
client = GaiaClient(DOWNLOAD_PATH, None, None, api_url="https://agents-course-unit4-scoring.hf.space")
|
32 |
result = client.download_file_for_task(task_id, filename)
|
33 |
|
@@ -257,6 +255,7 @@ Do NOT send commands that block indefinitely (e.g., `input()`).""",
|
|
257 |
class YouTubeFrameExtractor:
|
258 |
def __init__(self, model_path: str = 'yolov8n.pt', frame_rate: int = 1):
|
259 |
# Load YOLOv8 model
|
|
|
260 |
self.model = YOLO(model_path)
|
261 |
self.frame_rate = frame_rate # frames per second to sample
|
262 |
|
|
|
6 |
import cv2
|
7 |
from pathlib import Path
|
8 |
from yt_dlp import YoutubeDL
|
9 |
+
from ultralytics import YOLO, settings
|
10 |
from typing import List, Dict
|
11 |
from typing import TypedDict, Annotated
|
12 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
|
|
16 |
from utils import GaiaClient
|
17 |
|
18 |
|
|
|
|
|
|
|
|
|
19 |
@tool
|
20 |
def download_file(task_id: str, filename: str) -> str:
|
21 |
"""
|
|
|
24 |
task_id: The id of the task to download a related file.
|
25 |
filename: Path to store the file to.
|
26 |
"""
|
27 |
+
DOWNLOAD_PATH = Path("questions")
|
28 |
+
DOWNLOAD_PATH.mkdir(exist_ok=True)
|
29 |
client = GaiaClient(DOWNLOAD_PATH, None, None, api_url="https://agents-course-unit4-scoring.hf.space")
|
30 |
result = client.download_file_for_task(task_id, filename)
|
31 |
|
|
|
255 |
class YouTubeFrameExtractor:
|
256 |
def __init__(self, model_path: str = 'yolov8n.pt', frame_rate: int = 1):
|
257 |
# Load YOLOv8 model
|
258 |
+
settings.update({"runs_dir": "/path/to/runs"})
|
259 |
self.model = YOLO(model_path)
|
260 |
self.frame_rate = frame_rate # frames per second to sample
|
261 |
|