FrexG commited on
Commit
6b562eb
1 Parent(s): 63999aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -6,7 +6,8 @@ from pydub import AudioSegment
6
  from asr import Transcribe
7
 
8
 
9
- def transcribe(audio_file, lang_id: str):
 
10
  freq = 16000
11
  # Return the transcript.
12
  transcript = ""
@@ -19,11 +20,11 @@ def transcribe(audio_file, lang_id: str):
19
  if orig_freq != freq:
20
  waveform = AF.resample(waveform, orig_freq, freq)
21
 
22
- return transcriber(waveform, lang_id), audio_file.name
23
 
24
  if __name__ == "__main__":
25
  transcriber = Transcribe()
26
- inputs = [gr.File(), gr.Dropdown(choices=["amh", "orm", "som"])]
27
  outputs = [
28
  gr.Textbox(label="Transcript"),
29
  gr.Audio(label="Audio", type="filepath"),
 
6
  from asr import Transcribe
7
 
8
 
9
+ def transcribe(audio_file, language: str):
10
+ language_dict = {"Amharic":"amh","Oromo":"orm","Somali":"som"}
11
  freq = 16000
12
  # Return the transcript.
13
  transcript = ""
 
20
  if orig_freq != freq:
21
  waveform = AF.resample(waveform, orig_freq, freq)
22
 
23
+ return transcriber(waveform, langauge_dict[language]), audio_file.name
24
 
25
  if __name__ == "__main__":
26
  transcriber = Transcribe()
27
+ inputs = [gr.File(), gr.Dropdown(choices=["Amharic", "Oromo", "Somali"])]
28
  outputs = [
29
  gr.Textbox(label="Transcript"),
30
  gr.Audio(label="Audio", type="filepath"),