giulia-fontanella commited on
Commit
44c1168
·
verified ·
1 Parent(s): f9855e9

Update tools.py

Browse files
Files changed (1) hide show
  1. tools.py +22 -22
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
- 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
 
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