Spaces:
Runtime error
Runtime error
caching some stuff!
Browse files
app.py
CHANGED
@@ -57,6 +57,16 @@ def get_valid_epitran_mappings_list():
|
|
57 |
|
58 |
return filtered_mappings
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
|
61 |
if __name__ == "__main__":
|
62 |
|
@@ -75,17 +85,9 @@ if __name__ == "__main__":
|
|
75 |
|
76 |
description = get_lang_description_from_mapping_name(selected_mapping)
|
77 |
st.write(f"Selected input language/script: {description}")
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
st.info("Chinese requires a special dictionary. Downloading now")
|
82 |
-
epitran.download.cedict()
|
83 |
-
|
84 |
-
st.info("attempting to instantiate epitran transliterator for your language/script")
|
85 |
-
epi = epitran.Epitran(selected_mapping)
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
examples = defaultdict(lambda: 'Try typing some words in the language you chose, and they will be transliterated.')
|
90 |
examples['cmn-Hans'] = 'ε€ͺεζιοΌιδΈη₯εε¨οΌιε°±ζ―η₯γ'
|
91 |
examples['swa-Latn'] = 'Mwanzoni Kabla ulimwengu haujaumbwa alikuwepo Neno Huyo Neno alikuwa pamoja na Mungu, na Neno alikuwa Mungu.'
|
|
|
57 |
|
58 |
return filtered_mappings
|
59 |
|
60 |
+
@st.cache
|
61 |
+
def get_epitran(selected_mapping):
|
62 |
+
if selected_mapping == "cmn-Hans":
|
63 |
+
st.info("Chinese requires a special dictionary. Downloading now")
|
64 |
+
epitran.download.cedict()
|
65 |
+
|
66 |
+
st.info("attempting to instantiate epitran transliterator for your language/script")
|
67 |
+
epi = epitran.Epitran(selected_mapping)
|
68 |
+
return epi
|
69 |
+
|
70 |
|
71 |
if __name__ == "__main__":
|
72 |
|
|
|
85 |
|
86 |
description = get_lang_description_from_mapping_name(selected_mapping)
|
87 |
st.write(f"Selected input language/script: {description}")
|
88 |
+
|
89 |
+
epi = get_epitran(selected_mapping)
|
90 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
examples = defaultdict(lambda: 'Try typing some words in the language you chose, and they will be transliterated.')
|
92 |
examples['cmn-Hans'] = 'ε€ͺεζιοΌιδΈη₯εε¨οΌιε°±ζ―η₯γ'
|
93 |
examples['swa-Latn'] = 'Mwanzoni Kabla ulimwengu haujaumbwa alikuwepo Neno Huyo Neno alikuwa pamoja na Mungu, na Neno alikuwa Mungu.'
|