langcode-search / app.py
cdleong's picture
Update app.py
16fc4ca
raw
history blame
467 Bytes
import streamlit as st
import langcodes
# https://huggingface.co/blog/streamlit-spaces
langtext = st.text_area("language code", "en")
found = langcodes.find(langtext)
display = found.display_name()
if langcodes.tag_is_valid('langtext'):
st.write(f"'{langtext}' is a valid BCP-47 language code")
else:
st.write(f"'{langtext}' is not a valid BCP-47 language code")
st.write(f"langcodes found the following tag: {found}")
st.write(f"Display name: {display}")