wq2012 commited on
Commit
7a12ef3
·
verified ·
1 Parent(s): d377575

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  import os
3
  from sidlingvo import wav_to_lang
4
  from huggingface_hub import hf_hub_download
 
5
 
6
  title = "Spoken Language Identification"
7
 
@@ -21,8 +22,9 @@ runner = wav_to_lang.WavToLangRunner(
21
  langid_model_file=os.path.join(model_path, "conformer_langid_medium.tflite"))
22
 
23
  def predict(wav_file):
24
- top_lang, _ = runner.wav_to_lang(wav_file)
25
- return "Predicted language: " + top_lang
 
26
 
27
  if __name__ == "__main__":
28
  demo = gr.Interface(
 
2
  import os
3
  from sidlingvo import wav_to_lang
4
  from huggingface_hub import hf_hub_download
5
+ import numpy as np
6
 
7
  title = "Spoken Language Identification"
8
 
 
22
  langid_model_file=os.path.join(model_path, "conformer_langid_medium.tflite"))
23
 
24
  def predict(wav_file):
25
+ top_lang, probs = runner.wav_to_lang(wav_file)
26
+ top_lang_prob = np.max(probs)
27
+ return "Predicted language: " + top_lang + "\nProbability: " + top_lang_prob
28
 
29
  if __name__ == "__main__":
30
  demo = gr.Interface(