vakodiya commited on
Commit
514d2cf
1 Parent(s): 886fa65

Update audio_to_text.py

Browse files
Files changed (1) hide show
  1. audio_to_text.py +5 -10
audio_to_text.py CHANGED
@@ -4,16 +4,11 @@ import torch
4
  import os
5
  from pydub import AudioSegment
6
 
7
-
8
- # Get the directory of the current file
9
- current_dir = os.path.dirname(os.path.abspath(__file__))
10
- # Construct the absolute path to the 'ffmpeg/bin' directory
11
- ffmpeg_bin_path = os.path.join(current_dir, 'ffmpeg', 'bin')
12
- # Add this path to the PATH environment variable
13
- os.environ["PATH"] += os.pathsep + ffmpeg_bin_path
14
- # Ensure ffmpeg is in PATH
15
- AudioSegment.converter = os.path.join(ffmpeg_bin_path, 'ffmpeg.exe')
16
-
17
 
18
  # load model and processor
19
  processor = WhisperProcessor.from_pretrained("openai/whisper-small")
 
4
  import os
5
  from pydub import AudioSegment
6
 
7
+ # Install the specific version of FFmpeg
8
+ os.system("apt-get update")
9
+ os.system("apt-get install -y ffmpeg=7:6.1.1-3ubuntu5")
10
+ # Verify the installed version of FFmpeg
11
+ os.system("ffmpeg -version")
 
 
 
 
 
12
 
13
  # load model and processor
14
  processor = WhisperProcessor.from_pretrained("openai/whisper-small")