chinmaydan commited on
Commit
875c690
·
1 Parent(s): 35839aa

deciding on final language

Browse files
Files changed (1) hide show
  1. app.py +8 -17
app.py CHANGED
@@ -10,18 +10,13 @@ model = whisper.load_model("small")
10
 
11
  # A table to look up all the languages
12
  language_id_lookup = {
 
13
  "English" : "en",
 
14
  "German" : "de",
15
- "Greek" : "el",
16
  "Spanish" : "es",
17
- "Finnish" : "fi",
18
  "Russian" : "ru",
19
- "Hungarian" : "hu",
20
- "Dutch" : "nl",
21
  "French" : "fr",
22
- 'Polish' : "pl",
23
- 'Portuguese': "pt",
24
- 'Italian' : "it",
25
  }
26
 
27
 
@@ -69,26 +64,22 @@ def predict(audio, language, mic_audio=None):
69
  title = "Demo for Whisper -> Something -> XLS-R"
70
 
71
  description = """
72
- <b>How to use:</b> Upload an audio file or record using the microphone. The audio is converted to mono and resampled to 16 kHz before
73
- being passed into the model. The output is the text transcription of the audio.
 
74
  """
75
 
76
  gr.Interface(
77
  fn=predict,
78
  inputs=[
79
  gr.Audio(label="Upload Speech", source="upload", type="filepath"),
80
- gr.inputs.Dropdown(['English Text',
 
 
81
  'German Text',
82
- 'Greek Text',
83
  'Spanish Text',
84
- 'Finnish Text',
85
  'Russian Text',
86
- 'Hungarian Text',
87
- 'Dutch Text',
88
  'French Text',
89
- 'Polish Text',
90
- 'Portuguese Text',
91
- 'Italian Text',
92
  'Detect Language'], type="value", default='English Text', label="Select the Language of the that you are speaking in."),
93
  gr.Audio(label="Record Speech", source="microphone", type="filepath"),
94
  ],
 
10
 
11
  # A table to look up all the languages
12
  language_id_lookup = {
13
+ "Arabic" : "ar",
14
  "English" : "en",
15
+ "Chinese" : "zh",
16
  "German" : "de",
 
17
  "Spanish" : "es",
 
18
  "Russian" : "ru",
 
 
19
  "French" : "fr",
 
 
 
20
  }
21
 
22
 
 
64
  title = "Demo for Whisper -> Something -> XLS-R"
65
 
66
  description = """
67
+ <b>How to use:</b> Upload an audio file or record using the microphone. The audio is into the whisper model developed by openai.
68
+ The output is the text transcription of the audio in the language you inputted. If you asked the model to detect a language, it will
69
+ tell you what language it detected.
70
  """
71
 
72
  gr.Interface(
73
  fn=predict,
74
  inputs=[
75
  gr.Audio(label="Upload Speech", source="upload", type="filepath"),
76
+ gr.inputs.Dropdown(['Arabic Text',
77
+ 'Chinese Text',
78
+ 'English Text',
79
  'German Text',
 
80
  'Spanish Text',
 
81
  'Russian Text',
 
 
82
  'French Text',
 
 
 
83
  'Detect Language'], type="value", default='English Text', label="Select the Language of the that you are speaking in."),
84
  gr.Audio(label="Record Speech", source="microphone", type="filepath"),
85
  ],