Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
import langcodes
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
| 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")
|
|
@@ -37,8 +39,8 @@ if lang is None:
|
|
| 37 |
|
| 38 |
|
| 39 |
r12_url = f"https://r12a.github.io/app-subtags/?find={langtext}"
|
| 40 |
-
r =
|
| 41 |
-
r.html.
|
| 42 |
st.write(r.html.search("language codes"))
|
| 43 |
|
| 44 |
#st.write(f"langcodes found the following tag: {type(found)}") # a Language object
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import langcodes
|
| 3 |
+
import asyncio
|
| 4 |
+
loop = asyncio.get_running_loop()
|
| 5 |
+
from requests_html import AsyncHTMLSession
|
| 6 |
+
asession = AsyncHTMLSession(loop=loop)
|
| 7 |
|
| 8 |
# https://huggingface.co/blog/streamlit-spaces
|
| 9 |
langtext = st.text_input("language lookup using https://github.com/rspeer/langcodes, see also https://r12a.github.io/app-subtags/", "english")
|
|
|
|
| 39 |
|
| 40 |
|
| 41 |
r12_url = f"https://r12a.github.io/app-subtags/?find={langtext}"
|
| 42 |
+
r = await asession.get(r12_url)
|
| 43 |
+
r.html.arender()
|
| 44 |
st.write(r.html.search("language codes"))
|
| 45 |
|
| 46 |
#st.write(f"langcodes found the following tag: {type(found)}") # a Language object
|