Spaces:
Sleeping
Sleeping
gabrielaltay
commited on
Commit
•
2029299
1
Parent(s):
95a2a69
multiselect for congress num
Browse files
app.py
CHANGED
@@ -18,6 +18,7 @@ st.set_page_config(layout="wide", page_title="LegisQA")
|
|
18 |
SS = st.session_state
|
19 |
|
20 |
SEED = 292764
|
|
|
21 |
CONGRESS_GOV_TYPE_MAP = {
|
22 |
"hconres": "house-concurrent-resolution",
|
23 |
"hjres": "house-joint-resolution",
|
@@ -266,7 +267,14 @@ with st.sidebar:
|
|
266 |
)
|
267 |
st.text_input("Bill ID (e.g. 118-s-2293)", key="filter_legis_id")
|
268 |
st.text_input("Bioguide ID (e.g. R000595)", key="filter_bioguide_id")
|
269 |
-
st.text_input("Congress (e.g. 118)", key="filter_congress_num")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
|
271 |
with st.expander("Prompt Config"):
|
272 |
st.selectbox(
|
@@ -304,14 +312,18 @@ def get_vectorstore_filter():
|
|
304 |
vs_filter["legis_id"] = SS["filter_legis_id"]
|
305 |
if SS["filter_bioguide_id"] != "":
|
306 |
vs_filter["sponsor_bioguide_id"] = SS["filter_bioguide_id"]
|
307 |
-
if SS["filter_congress_num"] != "":
|
308 |
-
vs_filter["congress_num"] = int(SS["filter_congress_num"])
|
|
|
309 |
return vs_filter
|
310 |
|
311 |
|
312 |
if query_submitted:
|
313 |
|
314 |
vs_filter = get_vectorstore_filter()
|
|
|
|
|
|
|
315 |
retriever = vectorstore.as_retriever(
|
316 |
search_kwargs={"k": SS["n_ret_docs"], "filter": vs_filter},
|
317 |
)
|
@@ -377,6 +389,5 @@ if out:
|
|
377 |
write_doc_grp(legis_id, doc_grp)
|
378 |
|
379 |
with st.expander("Debug doc format"):
|
380 |
-
|
381 |
st.text_area("formatted docs", value=format_docs(out["context"]), height=600)
|
382 |
-
|
|
|
18 |
SS = st.session_state
|
19 |
|
20 |
SEED = 292764
|
21 |
+
CONGRESS_NUMBERS = [113, 114, 115, 116, 117, 118]
|
22 |
CONGRESS_GOV_TYPE_MAP = {
|
23 |
"hconres": "house-concurrent-resolution",
|
24 |
"hjres": "house-joint-resolution",
|
|
|
267 |
)
|
268 |
st.text_input("Bill ID (e.g. 118-s-2293)", key="filter_legis_id")
|
269 |
st.text_input("Bioguide ID (e.g. R000595)", key="filter_bioguide_id")
|
270 |
+
# st.text_input("Congress (e.g. 118)", key="filter_congress_num")
|
271 |
+
st.multiselect(
|
272 |
+
"Congress Numbers",
|
273 |
+
CONGRESS_NUMBERS,
|
274 |
+
default=CONGRESS_NUMBERS,
|
275 |
+
key="filter_congress_nums",
|
276 |
+
)
|
277 |
+
|
278 |
|
279 |
with st.expander("Prompt Config"):
|
280 |
st.selectbox(
|
|
|
312 |
vs_filter["legis_id"] = SS["filter_legis_id"]
|
313 |
if SS["filter_bioguide_id"] != "":
|
314 |
vs_filter["sponsor_bioguide_id"] = SS["filter_bioguide_id"]
|
315 |
+
# if SS["filter_congress_num"] != "":
|
316 |
+
# vs_filter["congress_num"] = int(SS["filter_congress_num"])
|
317 |
+
vs_filter = {"congress_num": {"$in": SS["filter_congress_nums"]}}
|
318 |
return vs_filter
|
319 |
|
320 |
|
321 |
if query_submitted:
|
322 |
|
323 |
vs_filter = get_vectorstore_filter()
|
324 |
+
with st.sidebar:
|
325 |
+
with st.expander("Debug vs_filter"):
|
326 |
+
st.write(vs_filter)
|
327 |
retriever = vectorstore.as_retriever(
|
328 |
search_kwargs={"k": SS["n_ret_docs"], "filter": vs_filter},
|
329 |
)
|
|
|
389 |
write_doc_grp(legis_id, doc_grp)
|
390 |
|
391 |
with st.expander("Debug doc format"):
|
|
|
392 |
st.text_area("formatted docs", value=format_docs(out["context"]), height=600)
|
393 |
+
|