Update transcribe.py
Browse files- 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 =
|
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
|