Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,14 +3,19 @@ import langcodes
|
|
3 |
|
4 |
# https://huggingface.co/blog/streamlit-spaces
|
5 |
langtext = st.text_area("language code", "en")
|
6 |
-
|
7 |
-
|
8 |
|
9 |
if langcodes.tag_is_valid('langtext'):
|
10 |
st.write(f"'{langtext}' is a valid BCP-47 language code")
|
|
|
11 |
else:
|
12 |
st.write(f"'{langtext}' is not a valid BCP-47 language code")
|
|
|
|
|
|
|
|
|
13 |
|
14 |
-
st.write(f"langcodes found the following tag: {found}")
|
15 |
#st.write(f"langcodes found the following tag: {type(found)}") # a Language object
|
16 |
-
|
|
|
|
3 |
|
4 |
# https://huggingface.co/blog/streamlit-spaces
|
5 |
langtext = st.text_area("language code", "en")
|
6 |
+
|
7 |
+
|
8 |
|
9 |
if langcodes.tag_is_valid('langtext'):
|
10 |
st.write(f"'{langtext}' is a valid BCP-47 language code")
|
11 |
+
lang = langcodes.Language.get(langtext)
|
12 |
else:
|
13 |
st.write(f"'{langtext}' is not a valid BCP-47 language code")
|
14 |
+
found = langcodes.find(langtext)
|
15 |
+
lang = found
|
16 |
+
st.write(f"langcodes found the following tag: {found}")
|
17 |
+
|
18 |
|
|
|
19 |
#st.write(f"langcodes found the following tag: {type(found)}") # a Language object
|
20 |
+
display = lang.display_name()
|
21 |
+
st.write(f"Display name for {lang}: {display}")
|