owaski commited on
Commit
b90393d
·
1 Parent(s): 0530dd9

add transcript

Browse files
Files changed (2) hide show
  1. app.py +3 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -69,6 +69,7 @@ def predict(audio, src_language, tgt_language, mic_audio=None):
69
  if src_language is None:
70
  src_language = result.language
71
 
 
72
  with open("input." + src_language, 'w') as w:
73
  w.write(result.text)
74
  with open("input." + tgt_language, 'w') as w:
@@ -100,7 +101,7 @@ def predict(audio, src_language, tgt_language, mic_audio=None):
100
  translation = (' '.join(r.readline().split(' ')[3:])).strip()
101
 
102
  # Returns the text
103
- return translation
104
 
105
 
106
 
@@ -136,6 +137,7 @@ gr.Interface(
136
  # To change to output audio, replace the outputs line with
137
  # outputs=gr.outputs.Audio(type="numpy", label=None)
138
  outputs=[
 
139
  gr.Text(label="Translation"),
140
  ],
141
  title=title,
 
69
  if src_language is None:
70
  src_language = result.language
71
 
72
+ transcript = result.text
73
  with open("input." + src_language, 'w') as w:
74
  w.write(result.text)
75
  with open("input." + tgt_language, 'w') as w:
 
101
  translation = (' '.join(r.readline().split(' ')[3:])).strip()
102
 
103
  # Returns the text
104
+ return transcript, translation
105
 
106
 
107
 
 
137
  # To change to output audio, replace the outputs line with
138
  # outputs=gr.outputs.Audio(type="numpy", label=None)
139
  outputs=[
140
+ gr.Text(label="Transcript"),
141
  gr.Text(label="Translation"),
142
  ],
143
  title=title,
requirements.txt CHANGED
@@ -6,3 +6,4 @@ sacrebleu
6
  sacremoses
7
  kytea
8
  six
 
 
6
  sacremoses
7
  kytea
8
  six
9
+ TTS