reab5555 commited on
Commit
594af05
·
verified ·
1 Parent(s): fee5ad2

Update transcribe.py

Browse files
Files changed (1) hide show
  1. transcribe.py +2 -2
transcribe.py CHANGED
@@ -7,7 +7,7 @@ from moviepy.editor import VideoFileClip, AudioFileClip
7
  import nltk
8
  nltk.download('punkt', quiet=True)
9
  from nltk.tokenize import sent_tokenize
10
-
11
 
12
  def transcribe(video_file, transcribe_to_text=True, transcribe_to_srt=True, target_language='en'):
13
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
@@ -39,7 +39,7 @@ def transcribe(video_file, transcribe_to_text=True, transcribe_to_srt=True, targ
39
 
40
 
41
  try:
42
- sound_array = AudioFileClip(temp_file_path).to_soundarray(fps=16000, nbytes=1, quantize=True)
43
  except Exception as e:
44
  print(f"Error reading audio file: {e}")
45
  continue # Skip this chunk if there's an error
 
7
  import nltk
8
  nltk.download('punkt', quiet=True)
9
  from nltk.tokenize import sent_tokenize
10
+ import librosa
11
 
12
  def transcribe(video_file, transcribe_to_text=True, transcribe_to_srt=True, target_language='en'):
13
  device = "cuda:0" if torch.cuda.is_available() else "cpu"
 
39
 
40
 
41
  try:
42
+ sound_array, _ = librosa.load(temp_file_path, sr=16000)
43
  except Exception as e:
44
  print(f"Error reading audio file: {e}")
45
  continue # Skip this chunk if there's an error