mrm8488 commited on
Commit
1239b09
β€’
1 Parent(s): 2df74ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -12,6 +12,7 @@ def inference(audio):
12
  mel = whisper.log_mel_spectrogram(audio).to(model.device)
13
 
14
  _, probs = model.detect_language(mel)
 
15
 
16
  options = whisper.DecodingOptions(fp16 = False)
17
  result = whisper.decode(model, mel, options)
@@ -157,12 +158,15 @@ with block:
157
  )
158
 
159
  btn = gr.Button("Transcribe")
 
 
 
160
  text = gr.Textbox(show_label=False)
161
 
162
 
163
 
164
 
165
- btn.click(inference, inputs=[audio], outputs=[text])
166
 
167
  gr.HTML('''
168
  <div class="footer">
 
12
  mel = whisper.log_mel_spectrogram(audio).to(model.device)
13
 
14
  _, probs = model.detect_language(mel)
15
+ lang = max(probs, key=probs.get)
16
 
17
  options = whisper.DecodingOptions(fp16 = False)
18
  result = whisper.decode(model, mel, options)
 
158
  )
159
 
160
  btn = gr.Button("Transcribe")
161
+
162
+ lang_str = gr.Textbox(show_label=False)
163
+
164
  text = gr.Textbox(show_label=False)
165
 
166
 
167
 
168
 
169
+ btn.click(inference, inputs=[audio], outputs=[lang_str,text])
170
 
171
  gr.HTML('''
172
  <div class="footer">