Update tools.py
Browse files
tools.py
CHANGED
|
@@ -5,7 +5,7 @@ from langchain.tools import tool
|
|
| 5 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
| 6 |
from langchain_community.document_loaders import WikipediaLoader, ArxivLoader
|
| 7 |
# import yt_dlp
|
| 8 |
-
import ffmpeg
|
| 9 |
|
| 10 |
|
| 11 |
@tool
|
|
@@ -231,29 +231,29 @@ class TranscribeAudio:
|
|
| 231 |
# return output_path
|
| 232 |
|
| 233 |
|
| 234 |
-
@tool
|
| 235 |
-
def extract_audio_from_video(video_path: str, audio_output: str) -> str:
|
| 236 |
-
|
| 237 |
-
|
| 238 |
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
|
| 243 |
-
|
| 244 |
-
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
|
| 258 |
|
| 259 |
@tool
|
|
|
|
| 5 |
from langchain_community.tools.tavily_search import TavilySearchResults
|
| 6 |
from langchain_community.document_loaders import WikipediaLoader, ArxivLoader
|
| 7 |
# import yt_dlp
|
| 8 |
+
# import ffmpeg
|
| 9 |
|
| 10 |
|
| 11 |
@tool
|
|
|
|
| 231 |
# return output_path
|
| 232 |
|
| 233 |
|
| 234 |
+
# @tool
|
| 235 |
+
# def extract_audio_from_video(video_path: str, audio_output: str) -> str:
|
| 236 |
+
# """
|
| 237 |
+
# Extracts audio from an MP4 video file and saves it as MP3.
|
| 238 |
|
| 239 |
+
# Args:
|
| 240 |
+
# video_path: Path to the input MP4 video file.
|
| 241 |
+
# audio_output: Path for the output MP3 file.
|
| 242 |
|
| 243 |
+
# Returns:
|
| 244 |
+
# Path to the audio file.
|
| 245 |
+
# """
|
| 246 |
+
# try:
|
| 247 |
+
# (
|
| 248 |
+
# ffmpeg
|
| 249 |
+
# .input(video_path)
|
| 250 |
+
# .output(audio_output, format='mp3', acodec='libmp3lame', t=60) # limit to 60 sec
|
| 251 |
+
# .overwrite_output()
|
| 252 |
+
# .run(quiet=True)
|
| 253 |
+
# )
|
| 254 |
+
# return audio_output
|
| 255 |
+
# except ffmpeg.Error as e:
|
| 256 |
+
# raise RuntimeError(f"FFmpeg error: {e.stderr.decode()}") from e
|
| 257 |
|
| 258 |
|
| 259 |
@tool
|