Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,18 @@ 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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
#def form_callback():
|
| 23 |
# st.write(st.session_state.my_slider)
|
|
|
|
| 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['option'][0] #throws an exception when visiting http://host:port
|
| 23 |
+
option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))
|
| 24 |
+
if option_selected:
|
| 25 |
+
st.experimental_set_query_params(option=option_selected)
|
| 26 |
+
except: # catch exception and set query param to predefined value
|
| 27 |
+
st.experimental_set_query_params(option="Genomics") # defaults to dog
|
| 28 |
+
query_params = st.experimental_get_query_params()
|
| 29 |
+
query_option = query_params['option'][0]
|
| 30 |
+
if option_selected:
|
| 31 |
+
st.experimental_set_query_params(option=option_selected)
|
| 32 |
|
| 33 |
#def form_callback():
|
| 34 |
# st.write(st.session_state.my_slider)
|