Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -27,6 +27,37 @@ if 'query' not in st.session_state:
|
|
27 |
st.session_state.query = 'value'
|
28 |
st.write(st.session_state.query)
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
@st.cache(
|
31 |
show_spinner=False,
|
32 |
hash_funcs={
|
@@ -133,36 +164,6 @@ model_choice = st.sidebar.selectbox("Similarity model", options=MODEL_OPTIONS)
|
|
133 |
model_id = 0 if model_choice == MODEL_OPTIONS[0] else 1
|
134 |
|
135 |
|
136 |
-
# Session state
|
137 |
-
if 'key' not in st.session_state:
|
138 |
-
st.session_state['key'] = 'value'
|
139 |
-
if 'key' not in st.session_state:
|
140 |
-
st.session_state.key = 'value'
|
141 |
-
st.write(st.session_state.key)
|
142 |
-
st.write(st.session_state)
|
143 |
-
|
144 |
-
#st.session_state
|
145 |
-
for key in st.session_state.keys():
|
146 |
-
del st.session_state[key]
|
147 |
-
st.text_input("Your name", key="name")
|
148 |
-
st.session_state.name
|
149 |
-
|
150 |
-
try:
|
151 |
-
query_params = st.experimental_get_query_params()
|
152 |
-
#query_option = query_params['option'][0] #throws an exception when visiting http://host:port
|
153 |
-
query_option = query_params['query'][0] #throws an exception when visiting http://host:port
|
154 |
-
option_selected = st.sidebar.selectbox('Pick option', options, index=options.index(query_option))
|
155 |
-
#if option_selected:
|
156 |
-
# st.experimental_set_query_params(option=option_selected)
|
157 |
-
except: # catch exception and set query param to predefined value
|
158 |
-
st.experimental_set_query_params(query="Genomics") # defaults to dog
|
159 |
-
query_params = st.experimental_get_query_params()
|
160 |
-
#query_option = query_params['option'][0]
|
161 |
-
query_option = query_params['query'][0]
|
162 |
-
#if option_selected:
|
163 |
-
# st.experimental_set_query_params(option=option_selected)
|
164 |
-
|
165 |
-
|
166 |
|
167 |
|
168 |
clicked = click_detector(semantic_search(query, model_id))
|
27 |
st.session_state.query = 'value'
|
28 |
st.write(st.session_state.query)
|
29 |
|
30 |
+
|
31 |
+
# Session state
|
32 |
+
if 'key' not in st.session_state:
|
33 |
+
st.session_state['key'] = 'value'
|
34 |
+
if 'key' not in st.session_state:
|
35 |
+
st.session_state.key = 'value'
|
36 |
+
st.write(st.session_state.key)
|
37 |
+
st.write(st.session_state)
|
38 |
+
|
39 |
+
#st.session_state
|
40 |
+
for key in st.session_state.keys():
|
41 |
+
del st.session_state[key]
|
42 |
+
#st.text_input("Your name", key="name")
|
43 |
+
#st.session_state.name
|
44 |
+
|
45 |
+
try:
|
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,
|
63 |
hash_funcs={
|
164 |
model_id = 0 if model_choice == MODEL_OPTIONS[0] else 1
|
165 |
|
166 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
|
169 |
clicked = click_detector(semantic_search(query, model_id))
|