Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -72,7 +72,14 @@ pipe = pipeline("automatic-speech-recognition", model="NbAiLab/nb-whisper-large"
|
|
72 |
@spaces.GPU()
|
73 |
def transcribe_audio(audio_file, filepath, batch_size=16, sample_rate=16000):
|
74 |
|
75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
#waveform, sample_rate = torchaudio.load("{filepath}") #2
|
77 |
|
78 |
# --convert to mono
|
|
|
72 |
@spaces.GPU()
|
73 |
def transcribe_audio(audio_file, 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.")
|
77 |
+
|
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
|