Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -70,7 +70,7 @@ def convert_to_wav(filepath):
|
|
70 |
pipe = pipeline("automatic-speech-recognition", model="NbAiLab/nb-whisper-large", chunk_length_s=30, generate_kwargs={'task': 'transcribe', 'language': 'no'})
|
71 |
|
72 |
@spaces.GPU()
|
73 |
-
def transcribe_audio(
|
74 |
|
75 |
if not isinstance(filepath, str):
|
76 |
raise ValueError("Expected a file path string, but received something else.")
|
@@ -78,9 +78,8 @@ def transcribe_audio(audio_file, filepath, batch_size=16, sample_rate=16000):
|
|
78 |
# Ensure the file exists before trying to load it
|
79 |
if not Path(filepath).is_file():
|
80 |
raise FileNotFoundError(f"The file {filepath} does not exist.")
|
81 |
-
|
82 |
-
waveform, sample_rate = torchaudio.load(filepath)
|
83 |
-
#waveform, sample_rate = torchaudio.load("{filepath}") #2
|
84 |
|
85 |
# --convert to mono
|
86 |
if waveform.ndim > 1:
|
|
|
70 |
pipe = pipeline("automatic-speech-recognition", model="NbAiLab/nb-whisper-large", chunk_length_s=30, generate_kwargs={'task': 'transcribe', 'language': 'no'})
|
71 |
|
72 |
@spaces.GPU()
|
73 |
+
def transcribe_audio(filepath, batch_size=16, sample_rate=16000):
|
74 |
|
75 |
if not isinstance(filepath, str):
|
76 |
raise ValueError("Expected a file path string, but received something else.")
|
|
|
78 |
# Ensure the file exists before trying to load it
|
79 |
if not Path(filepath).is_file():
|
80 |
raise FileNotFoundError(f"The file {filepath} does not exist.")
|
81 |
+
|
82 |
+
waveform, sample_rate = torchaudio.load("{filepath}")
|
|
|
83 |
|
84 |
# --convert to mono
|
85 |
if waveform.ndim > 1:
|