Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -57,17 +57,15 @@ def get_valid_epitran_mappings_list():
|
|
57 |
|
58 |
return filtered_mappings
|
59 |
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
#
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
if __name__ == "__main__":
|
71 |
|
72 |
st.write("# Phonemize your text with [Epitran](https://github.com/dmort27/epitran)!")
|
73 |
|
@@ -85,8 +83,13 @@ if __name__ == "__main__":
|
|
85 |
description = get_lang_description_from_mapping_name(selected_mapping)
|
86 |
st.write(f"Selected input language/script: {description}")
|
87 |
|
88 |
-
st.info("attempting to instantiate epitran transliterator for your language/script")
|
89 |
-
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
examples = defaultdict(lambda: 'Try typing some words in the language you chose, and they will be transliterated.')
|
92 |
examples['cmn-Hans'] = '太初有道,道与神同在,道就是神。'
|
@@ -94,9 +97,6 @@ if __name__ == "__main__":
|
|
94 |
|
95 |
input_text = st.text_area(label="Whatever you type here will be transliterated!", value=examples[selected_mapping])
|
96 |
|
97 |
-
# combined_code = "-".join([iso_lang_code, iso_script_code])
|
98 |
-
# st.write(f"Combined code: {combined_code}")
|
99 |
-
|
100 |
|
101 |
st.info(f"transliterating `{input_text}`\n\tusing {selected_mapping}...")
|
102 |
transliteration = epi.transliterate(input_text)
|
|
|
57 |
|
58 |
return filtered_mappings
|
59 |
|
60 |
+
## TODO: Fix unhashable type in return
|
61 |
+
#@st.cache
|
62 |
+
#def get_epitran(selected_mapping):
|
63 |
+
# if selected_mapping == "cmn-Hans":
|
64 |
+
## st.info("Chinese requires a special dictionary. Downloading now")
|
65 |
+
# epitran.download.cedict()
|
66 |
+
#
|
67 |
+
# epi = epitran.Epitran(selected_mapping)
|
68 |
+
# return epi
|
|
|
|
|
69 |
|
70 |
st.write("# Phonemize your text with [Epitran](https://github.com/dmort27/epitran)!")
|
71 |
|
|
|
83 |
description = get_lang_description_from_mapping_name(selected_mapping)
|
84 |
st.write(f"Selected input language/script: {description}")
|
85 |
|
86 |
+
st.info("attempting to instantiate epitran transliterator for your language/script"))
|
87 |
+
|
88 |
+
if selected_mapping == "cmn-Hans":
|
89 |
+
st.info("Chinese requires a special dictionary. Downloading now")
|
90 |
+
epitran.download.cedict()
|
91 |
+
|
92 |
+
epi = epitran.Epitran(selected_mapping)
|
93 |
|
94 |
examples = defaultdict(lambda: 'Try typing some words in the language you chose, and they will be transliterated.')
|
95 |
examples['cmn-Hans'] = '太初有道,道与神同在,道就是神。'
|
|
|
97 |
|
98 |
input_text = st.text_area(label="Whatever you type here will be transliterated!", value=examples[selected_mapping])
|
99 |
|
|
|
|
|
|
|
100 |
|
101 |
st.info(f"transliterating `{input_text}`\n\tusing {selected_mapping}...")
|
102 |
transliteration = epi.transliterate(input_text)
|