Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import langcodes
|
|
|
|
|
|
|
| 3 |
|
| 4 |
# https://huggingface.co/blog/streamlit-spaces
|
| 5 |
langtext = st.text_input("language lookup using https://github.com/rspeer/langcodes, see also https://r12a.github.io/app-subtags/", "english")
|
|
@@ -34,6 +36,11 @@ if lang is None:
|
|
| 34 |
lang = None
|
| 35 |
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
#st.write(f"langcodes found the following tag: {type(found)}") # a Language object
|
| 38 |
if lang is not None:
|
| 39 |
display = lang.display_name()
|
|
@@ -49,5 +56,5 @@ if lang is not None:
|
|
| 49 |
broader_tags = lang.broader_tags()
|
| 50 |
st.write(f"Broader tags for this language, if any: {broader_tags}")
|
| 51 |
st.write(f"Correct, standardized, BCP-47 tag for {langtext}, according to the langcodes library: {langcodes.standardize_tag(lang)}")
|
| 52 |
-
st.write(f"Try also: https://r12a.github.io/app-subtags
|
| 53 |
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import langcodes
|
| 3 |
+
from requests_html import HTMLSession
|
| 4 |
+
session = HTMLSession()
|
| 5 |
|
| 6 |
# https://huggingface.co/blog/streamlit-spaces
|
| 7 |
langtext = st.text_input("language lookup using https://github.com/rspeer/langcodes, see also https://r12a.github.io/app-subtags/", "english")
|
|
|
|
| 36 |
lang = None
|
| 37 |
|
| 38 |
|
| 39 |
+
r12_url = f"https://r12a.github.io/app-subtags/?find={langtext}"
|
| 40 |
+
r = session.get(r12_url)
|
| 41 |
+
r.html.render()
|
| 42 |
+
st.write(r.html.search("language codes"))
|
| 43 |
+
|
| 44 |
#st.write(f"langcodes found the following tag: {type(found)}") # a Language object
|
| 45 |
if lang is not None:
|
| 46 |
display = lang.display_name()
|
|
|
|
| 56 |
broader_tags = lang.broader_tags()
|
| 57 |
st.write(f"Broader tags for this language, if any: {broader_tags}")
|
| 58 |
st.write(f"Correct, standardized, BCP-47 tag for {langtext}, according to the langcodes library: {langcodes.standardize_tag(lang)}")
|
| 59 |
+
st.write(f"Try also: https://r12a.github.io/app-subtags/")
|
| 60 |
|