Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,29 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
import langcodes
|
3 |
-
import asyncio
|
4 |
|
5 |
-
# see https://github.com/streamlit/streamlit/issues/744#issuecomment-686712930
|
6 |
-
#loop = asyncio.get_running_loop()
|
7 |
-
loop = asyncio.new_event_loop()
|
8 |
-
asyncio.set_event_loop(loop)
|
9 |
-
|
10 |
-
|
11 |
-
from requests_html import AsyncHTMLSession
|
12 |
-
asession = AsyncHTMLSession()
|
13 |
-
|
14 |
-
async def get_r12():
|
15 |
-
r = await asession.get(f"https://r12a.github.io/app-subtags/?find=english")
|
16 |
-
await r.html.arender()
|
17 |
-
return r
|
18 |
|
19 |
|
20 |
|
21 |
# https://huggingface.co/blog/streamlit-spaces
|
22 |
langtext = st.text_input("language lookup using https://github.com/rspeer/langcodes, see also https://r12a.github.io/app-subtags/", "english")
|
23 |
|
24 |
-
results = asession.run(get_r12)
|
25 |
-
st.write(results)
|
26 |
-
|
27 |
st.write("Checking whether the tag is valid. That is, the language, script, territory, and variants (if present) are all tags that have meanings assigned by IANA.")
|
28 |
|
29 |
if langcodes.tag_is_valid(langtext):
|
|
|
1 |
import streamlit as st
|
2 |
import langcodes
|
|
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
|
5 |
|
6 |
|
7 |
# https://huggingface.co/blog/streamlit-spaces
|
8 |
langtext = st.text_input("language lookup using https://github.com/rspeer/langcodes, see also https://r12a.github.io/app-subtags/", "english")
|
9 |
|
|
|
|
|
|
|
10 |
st.write("Checking whether the tag is valid. That is, the language, script, territory, and variants (if present) are all tags that have meanings assigned by IANA.")
|
11 |
|
12 |
if langcodes.tag_is_valid(langtext):
|