Mohamed Aymane Farhi
commited on
Commit
·
6596104
1
Parent(s):
b867ef9
Add labels.
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ def transcribe(audio_file_mic=None, audio_file_upload=None, language="eng"):
|
|
| 15 |
else:
|
| 16 |
return "Please upload an audio file or record one"
|
| 17 |
|
| 18 |
-
# Make sure audio is 16kHz
|
| 19 |
speech, sample_rate = librosa.load(audio_file)
|
| 20 |
if sample_rate != 16000:
|
| 21 |
speech = librosa.resample(speech, orig_sr=sample_rate, target_sr=16000)
|
|
@@ -43,11 +43,11 @@ Supports [1162 languages](https://dl.fbaipublicfiles.com/mms/misc/language_cover
|
|
| 43 |
|
| 44 |
iface = gr.Interface(fn=transcribe,
|
| 45 |
inputs=[
|
| 46 |
-
gr.Audio(source="microphone", type="filepath"),
|
| 47 |
-
gr.Audio(source="upload", type="filepath"),
|
| 48 |
gr.Dropdown(choices=languages, label="Language", value="eng")
|
| 49 |
],
|
| 50 |
-
outputs=
|
| 51 |
examples=examples,
|
| 52 |
description=description
|
| 53 |
)
|
|
|
|
| 15 |
else:
|
| 16 |
return "Please upload an audio file or record one"
|
| 17 |
|
| 18 |
+
# Make sure audio is 16kHz
|
| 19 |
speech, sample_rate = librosa.load(audio_file)
|
| 20 |
if sample_rate != 16000:
|
| 21 |
speech = librosa.resample(speech, orig_sr=sample_rate, target_sr=16000)
|
|
|
|
| 43 |
|
| 44 |
iface = gr.Interface(fn=transcribe,
|
| 45 |
inputs=[
|
| 46 |
+
gr.Audio(source="microphone", type="filepath", label="Record Audio"),
|
| 47 |
+
gr.Audio(source="upload", type="filepath", label="Upload Audio"),
|
| 48 |
gr.Dropdown(choices=languages, label="Language", value="eng")
|
| 49 |
],
|
| 50 |
+
outputs=gr.Textbox(label="Transcription"),
|
| 51 |
examples=examples,
|
| 52 |
description=description
|
| 53 |
)
|