ReneeYe commited on
Commit
715d968
β€’
1 Parent(s): f565257
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +11 -10
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  title: ConST Speech2text Translator
3
- emoji: πŸŽ™οΈ
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
 
1
  ---
2
  title: ConST Speech2text Translator
3
+ emoji: πŸŽ™οΈπŸ“–
4
  colorFrom: yellow
5
  colorTo: purple
6
  sdk: gradio
app.py CHANGED
@@ -29,13 +29,13 @@ LANGUAGE_CODES = {
29
 
30
  LANG_GEN_SETUPS = {
31
  "de": {"beam": 10, "lenpen": 0.7},
32
- "es": {"beam": 10, "lenpen": 0.7},
33
- "fr": {"beam": 10, "lenpen": 0.7},
34
- "it": {"beam": 10, "lenpen": 0.7},
35
- "nl": {"beam": 10, "lenpen": 0.7},
36
- "pt": {"beam": 10, "lenpen": 0.7},
37
- "ro": {"beam": 10, "lenpen": 0.7},
38
- "ru": {"beam": 10, "lenpen": 0.1},
39
  }
40
 
41
  os.system("git clone https://github.com/ReneeYe/ConST")
@@ -111,9 +111,10 @@ def generate(model_path):
111
  return output.read().strip()
112
 
113
 
114
- def remove_temp_files():
115
  os.remove("temp.txt")
116
  os.remove("data/test_case.tsv")
 
117
 
118
 
119
  def run(audio_file, language):
@@ -123,7 +124,7 @@ def run(audio_file, language):
123
  get_vocab_and_yaml(language)
124
  model_path = get_model(language)
125
  generated_output = generate(model_path)
126
- remove_temp_files()
127
  return generated_output
128
  except:
129
  traceback.print_exc()
@@ -146,7 +147,7 @@ iface = gr.Interface(
146
  examples=[['case1.wav', "German"],['case2.wav', "German"], ['case3.wav', "German"]],
147
  title="ConST: an end-to-end speech translator",
148
  description="End-to-end Speech Translation Live Demo for English to eight European languages.",
149
- article="ConST is an end-to-end speech translation model (see paper <a href='https://arxiv.org/abs/2205.02444', target='_blank'>here</a>). "
150
  "Its motivation is to use contrastive learning method to learn similar representations for semantically similar speech and text.",
151
  theme="seafoam",
152
  layout='vertical',
 
29
 
30
  LANG_GEN_SETUPS = {
31
  "de": {"beam": 10, "lenpen": 0.7},
32
+ "es": {"beam": 10, "lenpen": 0.1},
33
+ "fr": {"beam": 10, "lenpen": 1.0},
34
+ "it": {"beam": 10, "lenpen": 0.5},
35
+ "nl": {"beam": 10, "lenpen": 0.4},
36
+ "pt": {"beam": 10, "lenpen": 0.9},
37
+ "ro": {"beam": 10, "lenpen": 1.0},
38
+ "ru": {"beam": 10, "lenpen": 0.3},
39
  }
40
 
41
  os.system("git clone https://github.com/ReneeYe/ConST")
 
111
  return output.read().strip()
112
 
113
 
114
+ def remove_temp_files(audio_file):
115
  os.remove("temp.txt")
116
  os.remove("data/test_case.tsv")
117
+ os.remove(f"data/{audio_file}")
118
 
119
 
120
  def run(audio_file, language):
 
124
  get_vocab_and_yaml(language)
125
  model_path = get_model(language)
126
  generated_output = generate(model_path)
127
+ remove_temp_files(converted_audio_file)
128
  return generated_output
129
  except:
130
  traceback.print_exc()
 
147
  examples=[['case1.wav', "German"],['case2.wav', "German"], ['case3.wav', "German"]],
148
  title="ConST: an end-to-end speech translator",
149
  description="End-to-end Speech Translation Live Demo for English to eight European languages.",
150
+ article="ConST is an end-to-end speech translation model (see paper at https://arxiv.org/abs/2205.02444 ). "
151
  "Its motivation is to use contrastive learning method to learn similar representations for semantically similar speech and text.",
152
  theme="seafoam",
153
  layout='vertical',