Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -70,11 +70,11 @@ 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 |
with tempfile.NamedTemporaryFile(suffix=".wav") as temp_audio_file:
|
76 |
# Copy the contents of the uploaded audio file to the temporary file
|
77 |
-
temp_audio_file.write(open(
|
78 |
temp_audio_file.flush()
|
79 |
# Load the audio file using torchaudio
|
80 |
waveform, sample_rate = torchaudio.load(temp_audio_file.name)
|
|
|
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(audio, batch_size=16):
|
74 |
|
75 |
with tempfile.NamedTemporaryFile(suffix=".wav") as temp_audio_file:
|
76 |
# Copy the contents of the uploaded audio file to the temporary file
|
77 |
+
temp_audio_file.write(open(audio, "rb").read())
|
78 |
temp_audio_file.flush()
|
79 |
# Load the audio file using torchaudio
|
80 |
waveform, sample_rate = torchaudio.load(temp_audio_file.name)
|