DebasishDhal99 commited on
Commit
24f7854
·
1 Parent(s): 1571261

Add transcribed original text, original language for whisper

Browse files
Files changed (2) hide show
  1. app.py +3 -1
  2. backend/audio_to_tgt.py +4 -3
app.py CHANGED
@@ -51,7 +51,9 @@ audio_interface = gr.Interface(
51
  label="Select Whisper Model size",
52
  )
53
  ],
54
- outputs=gr.Textbox(label="Translated Text in English"),
 
 
55
  title=heading_audio,
56
  description=description_audio
57
  )
 
51
  label="Select Whisper Model size",
52
  )
53
  ],
54
+ outputs=[gr.Textbox(label="Original text"),
55
+ gr.Textbox(label="Translated text"),
56
+ gr.Textbox(label="Original Language")],
57
  title=heading_audio,
58
  description=description_audio
59
  )
backend/audio_to_tgt.py CHANGED
@@ -15,7 +15,8 @@ def src_audio_to_eng_translator(audio_file_input, model_size = "turbo"):
15
 
16
  model = whisper.load_model(model_size)
17
  result = model.transcribe(audio_data)
18
-
19
- translated_text = GoogleTranslator(source='auto', target='en').translate(result["text"])
20
- return translated_text
 
21
  # return result['text']
 
15
 
16
  model = whisper.load_model(model_size)
17
  result = model.transcribe(audio_data)
18
+ input_text = result["text"]
19
+ language = result["language"]
20
+ translated_text = GoogleTranslator(source='auto', target='en').translate(input_text)
21
+ return input_text, translated_text, language
22
  # return result['text']