Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -256,7 +256,6 @@
|
|
| 256 |
# st.subheader(" RAG-Generated Summary")
|
| 257 |
# summary = rag_summarize(collected, summarizer)
|
| 258 |
# st.success(summary)
|
| 259 |
-
|
| 260 |
import streamlit as st
|
| 261 |
import pandas as pd
|
| 262 |
import re
|
|
@@ -333,7 +332,7 @@ def extract_topic_match(query, df):
|
|
| 333 |
# Streamlit UI setup
|
| 334 |
st.set_page_config(page_title="IL Trends Q&A", layout="wide")
|
| 335 |
st.title("Illinois Legislative Trends Q&A")
|
| 336 |
-
st.markdown("Ask about trends in
|
| 337 |
|
| 338 |
# Load data and models
|
| 339 |
df = load_data()
|
|
@@ -367,7 +366,7 @@ if query:
|
|
| 367 |
if not res:
|
| 368 |
st.warning("No relevant insights found.")
|
| 369 |
else:
|
| 370 |
-
st.subheader("
|
| 371 |
collected = []
|
| 372 |
|
| 373 |
for idx, score in sorted(res, key=lambda x: x[1], reverse=True)[:5]:
|
|
@@ -379,19 +378,20 @@ if query:
|
|
| 379 |
stance = row['stance_standardized']
|
| 380 |
trend_summary = row['llama_trend_summary'].strip()
|
| 381 |
bill_number = row['bill_number']
|
| 382 |
-
url = row['
|
| 383 |
|
| 384 |
st.markdown(f"---")
|
| 385 |
-
st.markdown(f" Date: {date} |
|
| 386 |
st.markdown(f"Category: {cat_std}")
|
| 387 |
st.markdown(f"Goal: {goal}")
|
| 388 |
-
st.markdown(f"Intent: {intent} | Stance: {stance}")
|
| 389 |
st.markdown(f"Trend Summary: {trend_summary}")
|
| 390 |
if pd.notna(url) and url.strip():
|
| 391 |
-
st.markdown(f"[ View Full Text]({url})")
|
| 392 |
|
| 393 |
collected.append(row['summary_insight'])
|
| 394 |
|
| 395 |
st.subheader(" RAG-Generated Summary")
|
| 396 |
summary = rag_summarize(collected, summarizer)
|
| 397 |
st.success(summary)
|
|
|
|
|
|
| 256 |
# st.subheader(" RAG-Generated Summary")
|
| 257 |
# summary = rag_summarize(collected, summarizer)
|
| 258 |
# st.success(summary)
|
|
|
|
| 259 |
import streamlit as st
|
| 260 |
import pandas as pd
|
| 261 |
import re
|
|
|
|
| 332 |
# Streamlit UI setup
|
| 333 |
st.set_page_config(page_title="IL Trends Q&A", layout="wide")
|
| 334 |
st.title("Illinois Legislative Trends Q&A")
|
| 335 |
+
st.markdown("Ask about trends in topics like education, higher education, funding, etc.")
|
| 336 |
|
| 337 |
# Load data and models
|
| 338 |
df = load_data()
|
|
|
|
| 366 |
if not res:
|
| 367 |
st.warning("No relevant insights found.")
|
| 368 |
else:
|
| 369 |
+
st.subheader("Top Matching Insights")
|
| 370 |
collected = []
|
| 371 |
|
| 372 |
for idx, score in sorted(res, key=lambda x: x[1], reverse=True)[:5]:
|
|
|
|
| 378 |
stance = row['stance_standardized']
|
| 379 |
trend_summary = row['llama_trend_summary'].strip()
|
| 380 |
bill_number = row['bill_number']
|
| 381 |
+
url = row['url']
|
| 382 |
|
| 383 |
st.markdown(f"---")
|
| 384 |
+
st.markdown(f" Date: {date} | Bill Number: `{bill_number}` | Score: {score:.2f}")
|
| 385 |
st.markdown(f"Category: {cat_std}")
|
| 386 |
st.markdown(f"Goal: {goal}")
|
| 387 |
+
st.markdown(f"Intent:** {intent} | Stance: {stance}")
|
| 388 |
st.markdown(f"Trend Summary: {trend_summary}")
|
| 389 |
if pd.notna(url) and url.strip():
|
| 390 |
+
st.markdown(f"[ View Full Bill Text]({url})")
|
| 391 |
|
| 392 |
collected.append(row['summary_insight'])
|
| 393 |
|
| 394 |
st.subheader(" RAG-Generated Summary")
|
| 395 |
summary = rag_summarize(collected, summarizer)
|
| 396 |
st.success(summary)
|
| 397 |
+
|