DrishtiSharma commited on
Commit
a97a975
·
1 Parent(s): 44d4c43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -25,6 +25,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
25
 
26
  new_line = '\n'
27
 
 
28
  def predict_and_ctc_lm_decode(input_file):
29
  speech = load_and_fix_data(input_file, sampling_rate)
30
  transcribed_text = asr(speech, chunk_length_s=5, stride_length_s=1)
@@ -32,7 +33,7 @@ def predict_and_ctc_lm_decode(input_file):
32
  input = tokenizer(transcribed_text, return_tensors="pt")
33
  output = model.generate(input["input_ids"], max_length=40, num_beams=4, early_stopping=True)
34
  output = tokenizer.decode(output[0], skip_special_tokens=True)
35
- return f"Spanish Audio Transcription: {transcribed_text} {new_line} Nahuatl Translation :{outputs}"
36
 
37
 
38
  gr.Interface(
@@ -43,7 +44,7 @@ gr.Interface(
43
  outputs=[gr.outputs.Textbox()],
44
  examples=[["audio_test.wav"], ["travel.wav"]],
45
  title="Spanish-Audio-Transcriptions-to-Quechua-Translation",
46
- description = "This is a Gradio demo of Spanish Audio Transcriptions to Nahuatl Translation. To use this, simply provide an audio input (audio recording or via microphone), which will subsequently be transcribed and translated to Nahuatl language.",
47
  #article="<p><center><img src='........e'></center></p>",
48
  layout="horizontal",
49
  theme="huggingface",
 
25
 
26
  new_line = '\n'
27
 
28
+
29
  def predict_and_ctc_lm_decode(input_file):
30
  speech = load_and_fix_data(input_file, sampling_rate)
31
  transcribed_text = asr(speech, chunk_length_s=5, stride_length_s=1)
 
33
  input = tokenizer(transcribed_text, return_tensors="pt")
34
  output = model.generate(input["input_ids"], max_length=40, num_beams=4, early_stopping=True)
35
  output = tokenizer.decode(output[0], skip_special_tokens=True)
36
+ return f"Spanish Audio Transcription: {transcribed_text} {new_line} Quechua Translation :{outputs}"
37
 
38
 
39
  gr.Interface(
 
44
  outputs=[gr.outputs.Textbox()],
45
  examples=[["audio_test.wav"], ["travel.wav"]],
46
  title="Spanish-Audio-Transcriptions-to-Quechua-Translation",
47
+ description = "This is a Gradio demo of Spanish Audio Transcriptions to Quechua Translation. To use this, simply provide an audio input (audio recording or via microphone), which will subsequently be transcribed and translated to Quechua language.",
48
  #article="<p><center><img src='........e'></center></p>",
49
  layout="horizontal",
50
  theme="huggingface",