Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -17,22 +17,6 @@ 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 |
-
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)
|
35 |
-
# st.write(st.session_state.my_checkbox)
|
36 |
|
37 |
@st.cache(
|
38 |
show_spinner=False,
|
@@ -141,6 +125,10 @@ model_id = 0 if model_choice == MODEL_OPTIONS[0] else 1
|
|
141 |
|
142 |
|
143 |
|
|
|
|
|
|
|
|
|
144 |
if 'query' not in st.session_state:
|
145 |
query = st.text_input("", value="artificial intelligence", key="query")
|
146 |
#st.session_state['query'] = query
|
@@ -156,8 +144,8 @@ if 'key' not in st.session_state:
|
|
156 |
st.session_state.key = 'value'
|
157 |
st.write(st.session_state.key)
|
158 |
|
159 |
-
st.session_state.key = 'value2' # Attribute API
|
160 |
-
st.session_state['key'] = 'value2' # Dictionary like API
|
161 |
|
162 |
st.write(st.session_state)
|
163 |
|
@@ -167,6 +155,23 @@ for key in st.session_state.keys():
|
|
167 |
st.text_input("Your name", key="name")
|
168 |
st.session_state.name
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
clicked = click_detector(semantic_search(query, model_id))
|
172 |
|
|
|
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 |
@st.cache(
|
22 |
show_spinner=False,
|
|
|
125 |
|
126 |
|
127 |
|
128 |
+
#def form_callback():
|
129 |
+
# st.write(st.session_state.my_slider)
|
130 |
+
# st.write(st.session_state.my_checkbox)
|
131 |
+
|
132 |
if 'query' not in st.session_state:
|
133 |
query = st.text_input("", value="artificial intelligence", key="query")
|
134 |
#st.session_state['query'] = query
|
|
|
144 |
st.session_state.key = 'value'
|
145 |
st.write(st.session_state.key)
|
146 |
|
147 |
+
#st.session_state.key = 'value2' # Attribute API
|
148 |
+
#st.session_state['key'] = 'value2' # Dictionary like API
|
149 |
|
150 |
st.write(st.session_state)
|
151 |
|
|
|
155 |
st.text_input("Your name", key="name")
|
156 |
st.session_state.name
|
157 |
|
158 |
+
try:
|
159 |
+
query_params = st.experimental_get_query_params()
|
160 |
+
#query_option = query_params['option'][0] #throws an exception when visiting http://host:port
|
161 |
+
query_option = query_params['query'][0] #throws an exception when visiting http://host:port
|
162 |
+
option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))
|
163 |
+
#if option_selected:
|
164 |
+
# st.experimental_set_query_params(option=option_selected)
|
165 |
+
except: # catch exception and set query param to predefined value
|
166 |
+
st.experimental_set_query_params(option="Genomics") # defaults to dog
|
167 |
+
query_params = st.experimental_get_query_params()
|
168 |
+
#query_option = query_params['option'][0]
|
169 |
+
query_option = query_params['query'][0]
|
170 |
+
#if option_selected:
|
171 |
+
# st.experimental_set_query_params(option=option_selected)
|
172 |
+
|
173 |
+
|
174 |
+
|
175 |
|
176 |
clicked = click_detector(semantic_search(query, model_id))
|
177 |
|