Spaces:
Runtime error
Runtime error
Attempt to use format_func on dropdown
Browse files
app.py
CHANGED
@@ -57,15 +57,9 @@ def get_valid_epitran_mappings_list():
|
|
57 |
|
58 |
return filtered_mappings
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
st.info("Chinese requires a special dictionary. Downloading now")
|
64 |
-
epitran.download.cedict()
|
65 |
-
|
66 |
-
epi = epitran.Epitran(selected_mapping)
|
67 |
-
st.info("...instantiated successfully")
|
68 |
-
return epi
|
69 |
|
70 |
|
71 |
if __name__ == "__main__":
|
@@ -75,12 +69,16 @@ if __name__ == "__main__":
|
|
75 |
st.write("Epitran is a library and tool for transliterating orthographic text as IPA (International Phonetic Alphabet), by Mortensen, David R. and Dalmia, Siddharth and Littell, Patrick.")
|
76 |
|
77 |
valid_epitran_mappings = get_valid_epitran_mappings_list()
|
78 |
-
|
|
|
|
|
|
|
|
|
79 |
st.write(f"It supports converting many writing sytems to IPA symbols, including approximately {len(valid_epitran_mappings)} languages/scripts, listed below:")
|
80 |
|
81 |
#st.write(valid_epitran_mappings)
|
82 |
|
83 |
-
selected_mapping = st.selectbox("Select input language/script:", valid_epitran_mappings, index=index_of_swa_latn)
|
84 |
|
85 |
|
86 |
description = get_lang_description_from_mapping_name(selected_mapping)
|
|
|
57 |
|
58 |
return filtered_mappings
|
59 |
|
60 |
+
|
61 |
+
|
62 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
|
65 |
if __name__ == "__main__":
|
|
|
69 |
st.write("Epitran is a library and tool for transliterating orthographic text as IPA (International Phonetic Alphabet), by Mortensen, David R. and Dalmia, Siddharth and Littell, Patrick.")
|
70 |
|
71 |
valid_epitran_mappings = get_valid_epitran_mappings_list()
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
index_of_desired_default = descriptions.index("Swahili")
|
77 |
st.write(f"It supports converting many writing sytems to IPA symbols, including approximately {len(valid_epitran_mappings)} languages/scripts, listed below:")
|
78 |
|
79 |
#st.write(valid_epitran_mappings)
|
80 |
|
81 |
+
selected_mapping = st.selectbox("Select input language/script:", valid_epitran_mappings, index=index_of_swa_latn, format_func=get_lang_description_from_mapping_name)
|
82 |
|
83 |
|
84 |
description = get_lang_description_from_mapping_name(selected_mapping)
|