Update app.py
Browse files
app.py
CHANGED
@@ -15,9 +15,13 @@ def ASR(audio):
|
|
15 |
# Copy the contents of the uploaded audio file to the temporary file
|
16 |
temp_audio_file.write(open(audio, "rb").read())
|
17 |
temp_audio_file.flush()
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
21 |
return text
|
22 |
iface = gr.Interface(fn=ASR, inputs=audio_input, outputs="text")
|
23 |
iface.launch(share=False)
|
|
|
15 |
# Copy the contents of the uploaded audio file to the temporary file
|
16 |
temp_audio_file.write(open(audio, "rb").read())
|
17 |
temp_audio_file.flush()
|
18 |
+
# Load the audio file using torchaudio
|
19 |
+
waveform, sample_rate = torchaudio.load(temp_audio_file.name)
|
20 |
+
|
21 |
+
# Convert the PyTorch tensor to a NumPy ndarray
|
22 |
+
audio_array = waveform.numpy()
|
23 |
+
#inputs = processor(audio_array, sampling_rate=16_000)
|
24 |
+
text = pipe(audio_array)
|
25 |
return text
|
26 |
iface = gr.Interface(fn=ASR, inputs=audio_input, outputs="text")
|
27 |
iface.launch(share=False)
|