Spaces:
Runtime error
Runtime error
update output formatting
Browse files
app.py
CHANGED
|
@@ -37,13 +37,13 @@ def get_path_to_wav_format(uploaded_file):
|
|
| 37 |
torchaudio.save(new_desired_path, waveform, sample_rate)
|
| 38 |
return new_desired_path
|
| 39 |
|
| 40 |
-
|
| 41 |
def get_langcode_description(input_code):
|
| 42 |
langcode = "ipa" # the default allosaurus recognizer
|
| 43 |
description = "the default universal setting, not specific to any language"
|
| 44 |
|
| 45 |
if not input_code or input_code==langcode:
|
| 46 |
-
return
|
| 47 |
|
| 48 |
|
| 49 |
|
|
@@ -55,8 +55,11 @@ def get_langcode_description(input_code):
|
|
| 55 |
|
| 56 |
except langcodes.LanguageTagError as e:
|
| 57 |
pass
|
| 58 |
-
return
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
|
| 62 |
if __name__ == "__main__":
|
|
@@ -66,7 +69,7 @@ if __name__ == "__main__":
|
|
| 66 |
langcode = st.selectbox("ISO code for input language. Allosaurus doesn't need this, but it can improve accuracy",
|
| 67 |
options=supported_codes,
|
| 68 |
index=index_of_desired_default,
|
| 69 |
-
format_func=
|
| 70 |
)
|
| 71 |
|
| 72 |
model = read_recognizer()
|
|
|
|
| 37 |
torchaudio.save(new_desired_path, waveform, sample_rate)
|
| 38 |
return new_desired_path
|
| 39 |
|
| 40 |
+
@st.cache
|
| 41 |
def get_langcode_description(input_code):
|
| 42 |
langcode = "ipa" # the default allosaurus recognizer
|
| 43 |
description = "the default universal setting, not specific to any language"
|
| 44 |
|
| 45 |
if not input_code or input_code==langcode:
|
| 46 |
+
return description
|
| 47 |
|
| 48 |
|
| 49 |
|
|
|
|
| 55 |
|
| 56 |
except langcodes.LanguageTagError as e:
|
| 57 |
pass
|
| 58 |
+
return description
|
| 59 |
+
|
| 60 |
+
@st.cache
|
| 61 |
+
def get_langcode_with_description(input_code):
|
| 62 |
+
return f"{input_code}: {get_langcode_description(input_code)}"
|
| 63 |
|
| 64 |
|
| 65 |
if __name__ == "__main__":
|
|
|
|
| 69 |
langcode = st.selectbox("ISO code for input language. Allosaurus doesn't need this, but it can improve accuracy",
|
| 70 |
options=supported_codes,
|
| 71 |
index=index_of_desired_default,
|
| 72 |
+
format_func=get_langcode_with_description
|
| 73 |
)
|
| 74 |
|
| 75 |
model = read_recognizer()
|