Spaces:
Runtime error
Runtime error
get URL to iso 639-3
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ def get_path_to_wav_format(uploaded_file):
|
|
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 |
|
@@ -51,7 +51,11 @@ def get_langcode_description(input_code):
|
|
51 |
lang = langcodes.get(input_code)
|
52 |
alpha3 = lang.to_alpha3()
|
53 |
langcode = alpha3
|
54 |
-
|
|
|
|
|
|
|
|
|
55 |
|
56 |
except langcodes.LanguageTagError as e:
|
57 |
pass
|
@@ -73,7 +77,7 @@ if __name__ == "__main__":
|
|
73 |
)
|
74 |
|
75 |
model = read_recognizer()
|
76 |
-
description = get_langcode_description(langcode)
|
77 |
|
78 |
st.write(f"Instructing Allosaurus to recognize using language {langcode}. That is, {description}")
|
79 |
|
|
|
38 |
return new_desired_path
|
39 |
|
40 |
@st.cache
|
41 |
+
def get_langcode_description(input_code, url=False):
|
42 |
langcode = "ipa" # the default allosaurus recognizer
|
43 |
description = "the default universal setting, not specific to any language"
|
44 |
|
|
|
51 |
lang = langcodes.get(input_code)
|
52 |
alpha3 = lang.to_alpha3()
|
53 |
langcode = alpha3
|
54 |
+
display_name = lang.display_name()
|
55 |
+
if url:
|
56 |
+
description = f"[{display_name}](https://iso639-3.sil.org/code/{alpha3})"
|
57 |
+
else:
|
58 |
+
description = display_name
|
59 |
|
60 |
except langcodes.LanguageTagError as e:
|
61 |
pass
|
|
|
77 |
)
|
78 |
|
79 |
model = read_recognizer()
|
80 |
+
description = get_langcode_description(langcode, url=True)
|
81 |
|
82 |
st.write(f"Instructing Allosaurus to recognize using language {langcode}. That is, {description}")
|
83 |
|