Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,6 +17,15 @@ DESCRIPTION = """
|
|
| 17 |
Built with π€ Hugging Face's [transformers](https://huggingface.co/transformers/) library, [SentenceBert](https://www.sbert.net/) models, [Streamlit](https://streamlit.io/) and 44k movie descriptions from the Kaggle [Movies Dataset](https://www.kaggle.com/rounakbanik/the-movies-dataset)
|
| 18 |
"""
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
if 'query' not in st.session_state:
|
| 21 |
#st.session_state['query'] = 'value'
|
| 22 |
query = st.text_input("", value="artificial intelligence", key="query")
|
|
@@ -42,21 +51,7 @@ for key in st.session_state.keys():
|
|
| 42 |
#st.text_input("Your name", key="name")
|
| 43 |
#st.session_state.name
|
| 44 |
|
| 45 |
-
|
| 46 |
-
query_params = st.experimental_get_query_params()
|
| 47 |
-
#query_option = query_params['option'][0] #throws an exception when visiting http://host:port
|
| 48 |
-
query_option = query_params['query'][0] #throws an exception when visiting http://host:port
|
| 49 |
-
option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))
|
| 50 |
-
#if option_selected:
|
| 51 |
-
# st.experimental_set_query_params(option=option_selected)
|
| 52 |
-
except: # catch exception and set query param to predefined value
|
| 53 |
-
st.experimental_set_query_params(query="Genomics") # defaults to dog
|
| 54 |
-
query_params = st.experimental_get_query_params()
|
| 55 |
-
#query_option = query_params['option'][0]
|
| 56 |
-
query_option = query_params['query'][0]
|
| 57 |
-
#if option_selected:
|
| 58 |
-
# st.experimental_set_query_params(option=option_selected)
|
| 59 |
-
|
| 60 |
|
| 61 |
@st.cache(
|
| 62 |
show_spinner=False,
|
|
|
|
| 17 |
Built with π€ Hugging Face's [transformers](https://huggingface.co/transformers/) library, [SentenceBert](https://www.sbert.net/) models, [Streamlit](https://streamlit.io/) and 44k movie descriptions from the Kaggle [Movies Dataset](https://www.kaggle.com/rounakbanik/the-movies-dataset)
|
| 18 |
"""
|
| 19 |
|
| 20 |
+
try:
|
| 21 |
+
query_params = st.experimental_get_query_params()
|
| 22 |
+
query_option = query_params['query'][0] #throws an exception when visiting http://host:port
|
| 23 |
+
option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))
|
| 24 |
+
except: # catch exception and set query param to predefined value
|
| 25 |
+
st.experimental_set_query_params(query="Genomics") # defaults to dog
|
| 26 |
+
query_params = st.experimental_get_query_params()
|
| 27 |
+
query_option = query_params['query'][0]
|
| 28 |
+
|
| 29 |
if 'query' not in st.session_state:
|
| 30 |
#st.session_state['query'] = 'value'
|
| 31 |
query = st.text_input("", value="artificial intelligence", key="query")
|
|
|
|
| 51 |
#st.text_input("Your name", key="name")
|
| 52 |
#st.session_state.name
|
| 53 |
|
| 54 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
@st.cache(
|
| 57 |
show_spinner=False,
|