jiuuee commited on
Commit
43073b4
1 Parent(s): 1c50673

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -29
app.py CHANGED
@@ -92,36 +92,9 @@ def transcribe(audio_filepath, src_lang, tgt_lang, pnc):
92
 
93
  utt_id = uuid.uuid4()
94
  with tempfile.TemporaryDirectory() as tmpdir:
95
- converted_audio_filepath, duration = convert_audio(audio_filepath, tmpdir, str(utt_id))
96
-
97
- # map src_lang and tgt_lang from long versions to short
98
- LANG_LONG_TO_LANG_SHORT = {
99
- "English": "en",
100
- "Spanish": "es",
101
- "French": "fr",
102
- "German": "de",
103
- }
104
- if src_lang not in LANG_LONG_TO_LANG_SHORT.keys():
105
- raise ValueError(f"src_lang must be one of {LANG_LONG_TO_LANG_SHORT.keys()}")
106
- else:
107
- src_lang = LANG_LONG_TO_LANG_SHORT[src_lang]
108
-
109
- if tgt_lang not in LANG_LONG_TO_LANG_SHORT.keys():
110
- raise ValueError(f"tgt_lang must be one of {LANG_LONG_TO_LANG_SHORT.keys()}")
111
- else:
112
- tgt_lang = LANG_LONG_TO_LANG_SHORT[tgt_lang]
113
 
114
-
115
- # infer taskname from src_lang and tgt_lang
116
- if src_lang == tgt_lang:
117
- taskname = "asr"
118
- else:
119
- taskname = "s2t_translation"
120
-
121
- # update pnc variable to be "yes" or "no"
122
- pnc = "yes" if pnc else "no"
123
-
124
- # make manifest file and save
125
  manifest_data = {
126
  "audio_filepath": converted_audio_filepath,
127
  "source_lang": src_lang,
 
92
 
93
  utt_id = uuid.uuid4()
94
  with tempfile.TemporaryDirectory() as tmpdir:
95
+ converted_audio_filepath, duration = convert_audio(audio_filepath, tmpdir, str(utt_
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
 
97
+ # make manifest file and save
 
 
 
 
 
 
 
 
 
 
98
  manifest_data = {
99
  "audio_filepath": converted_audio_filepath,
100
  "source_lang": src_lang,