Spaces:
Sleeping
Sleeping
gabrielaltay
commited on
Commit
•
6bfad85
1
Parent(s):
80275c5
more text
Browse files
app.py
CHANGED
@@ -108,10 +108,11 @@ def write_outreach_links():
|
|
108 |
nomic_map_name = "us-congressional-legislation-s1024o256nomic"
|
109 |
nomic_url = f"{nomic_base_url}/{nomic_map_name}/map"
|
110 |
hf_url = "https://huggingface.co/hyperdemocracy"
|
111 |
-
|
112 |
-
st.subheader(
|
113 |
-
st.subheader(f":
|
114 |
-
|
|
|
115 |
|
116 |
def group_docs(docs) -> list[tuple[str, list[Document]]]:
|
117 |
doc_grps = defaultdict(list)
|
@@ -217,6 +218,30 @@ def escape_markdown(text):
|
|
217 |
return text
|
218 |
|
219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
with st.sidebar:
|
221 |
|
222 |
with st.container(border=True):
|
@@ -269,7 +294,7 @@ vectorstore = load_pinecone_vectorstore()
|
|
269 |
format_docs = DOC_FORMATTERS[SS["prompt_version"]]
|
270 |
|
271 |
with st.form("my_form"):
|
272 |
-
st.text_area("Enter
|
273 |
query_submitted = st.form_submit_button("Submit")
|
274 |
|
275 |
|
|
|
108 |
nomic_map_name = "us-congressional-legislation-s1024o256nomic"
|
109 |
nomic_url = f"{nomic_base_url}/{nomic_map_name}/map"
|
110 |
hf_url = "https://huggingface.co/hyperdemocracy"
|
111 |
+
pc_url = "https://www.pinecone.io/blog/serverless"
|
112 |
+
st.subheader(":brain: About [hyperdemocracy](https://hyperdemocracy.us)")
|
113 |
+
st.subheader(f":world_map: Visualize [nomic atlas]({nomic_url})")
|
114 |
+
st.subheader(f":hugging_face: Raw [huggingface datasets](hf_url)")
|
115 |
+
st.subheader(f":evergreen_tree: Index [pinecone serverless](pc_url)")
|
116 |
|
117 |
def group_docs(docs) -> list[tuple[str, list[Document]]]:
|
118 |
doc_grps = defaultdict(list)
|
|
|
218 |
return text
|
219 |
|
220 |
|
221 |
+
st.title(":classical_building: LegisQA :classical_building:")
|
222 |
+
st.header("Explore Congressional Legislation")
|
223 |
+
st.write(
|
224 |
+
"""When you send a query to LegisQA, it will attempt to retrieve relevant content from the past six congresses ([113th-118th](https://en.wikipedia.org/wiki/List_of_United_States_Congresses)) covering 2013 to the present, pass it to a [large language model (LLM)](https://en.wikipedia.org/wiki/Large_language_model), and generate a response. This technique is known as Retrieval Augmented Generation (RAG). You can read [an academic paper](https://proceedings.neurips.cc/paper/2020/hash/6b493230205f780e1bc26945df7481e5-Abstract.html) or [a high level summary](https://research.ibm.com/blog/retrieval-augmented-generation-RAG) to get more details. Once the response is generated, the retrieved content will be available for inspection with links to the bills and sponsors.
|
225 |
+
This technique helps to ground the LLM response by providing context from a trusted source, but it does not guarantee a high quality response. We encourage you to play around. Try different models. Find questions that work and find questions that fail.""")
|
226 |
+
|
227 |
+
st.header("Example Queries")
|
228 |
+
|
229 |
+
st.write("""
|
230 |
+
```
|
231 |
+
What are the themes around artificial intelligence?
|
232 |
+
```
|
233 |
+
|
234 |
+
```
|
235 |
+
Write a well cited 3 paragraph essay on food insecurity.
|
236 |
+
```
|
237 |
+
|
238 |
+
```
|
239 |
+
Create a table summarizing the major climate change ideas with columns legis_id, title, idea.
|
240 |
+
```
|
241 |
+
"""
|
242 |
+
)
|
243 |
+
|
244 |
+
|
245 |
with st.sidebar:
|
246 |
|
247 |
with st.container(border=True):
|
|
|
294 |
format_docs = DOC_FORMATTERS[SS["prompt_version"]]
|
295 |
|
296 |
with st.form("my_form"):
|
297 |
+
st.text_area("Enter query:", key="query")
|
298 |
query_submitted = st.form_submit_button("Submit")
|
299 |
|
300 |
|