Spaces:
Sleeping
Sleeping
Arthur Passuello
commited on
Commit
Β·
0fb647e
1
Parent(s):
eb1cc8a
Minor demo fixes
Browse files- streamlit_epic2_demo.py +54 -6
streamlit_epic2_demo.py
CHANGED
|
@@ -182,10 +182,16 @@ def main():
|
|
| 182 |
"π§ Technical Deep-dive": "technical_deepdive"
|
| 183 |
}
|
| 184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 185 |
selected_page = st.sidebar.selectbox(
|
| 186 |
"Select Demo Page:",
|
| 187 |
list(pages.keys()),
|
| 188 |
-
index=
|
| 189 |
)
|
| 190 |
|
| 191 |
# System status in sidebar
|
|
@@ -206,8 +212,13 @@ def main():
|
|
| 206 |
st.sidebar.markdown(f"**Architecture:** {system_status['architecture'].title()}")
|
| 207 |
st.sidebar.markdown("**Epic 2 Features:** β
All Active")
|
| 208 |
else:
|
| 209 |
-
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
|
| 212 |
# Model specifications in sidebar
|
| 213 |
st.sidebar.markdown("---")
|
|
@@ -298,12 +309,15 @@ def show_system_overview():
|
|
| 298 |
col1, col2, col3 = st.columns([1, 2, 1])
|
| 299 |
with col2:
|
| 300 |
if not system_manager.is_initialized:
|
|
|
|
|
|
|
| 301 |
if st.button("π Initialize Epic 2 System", type="primary", use_container_width=True):
|
| 302 |
initialize_epic2_system()
|
| 303 |
|
| 304 |
# Show demo mode info
|
| 305 |
-
st.info("π **Demo Mode**: Using 10 documents for faster initialization")
|
| 306 |
st.info("π§ **Architecture**: ModularUnifiedRetriever with all Epic 2 features")
|
|
|
|
| 307 |
else:
|
| 308 |
system_status = system_manager.get_system_status()
|
| 309 |
st.success(f"β
Epic 2 System Online - {system_status['documents']} Documents Ready")
|
|
@@ -547,7 +561,24 @@ def show_interactive_query():
|
|
| 547 |
st.header("π¬ Interactive Query Interface")
|
| 548 |
|
| 549 |
if not system_manager.is_initialized:
|
| 550 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 551 |
return
|
| 552 |
|
| 553 |
# Query input section
|
|
@@ -589,7 +620,24 @@ def show_results_analysis():
|
|
| 589 |
st.header("π Results Analysis Dashboard")
|
| 590 |
|
| 591 |
if not system_manager.is_initialized:
|
| 592 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 593 |
return
|
| 594 |
|
| 595 |
# Check if we have query results to analyze
|
|
|
|
| 182 |
"π§ Technical Deep-dive": "technical_deepdive"
|
| 183 |
}
|
| 184 |
|
| 185 |
+
# Handle forced navigation to overview
|
| 186 |
+
default_index = 0
|
| 187 |
+
if hasattr(st.session_state, 'force_overview') and st.session_state.force_overview:
|
| 188 |
+
default_index = 0
|
| 189 |
+
st.session_state.force_overview = False # Reset the flag
|
| 190 |
+
|
| 191 |
selected_page = st.sidebar.selectbox(
|
| 192 |
"Select Demo Page:",
|
| 193 |
list(pages.keys()),
|
| 194 |
+
index=default_index
|
| 195 |
)
|
| 196 |
|
| 197 |
# System status in sidebar
|
|
|
|
| 212 |
st.sidebar.markdown(f"**Architecture:** {system_status['architecture'].title()}")
|
| 213 |
st.sidebar.markdown("**Epic 2 Features:** β
All Active")
|
| 214 |
else:
|
| 215 |
+
if not system_manager.is_initialized:
|
| 216 |
+
st.sidebar.markdown("**Status:** <span style='color: #dc3545; font-weight: bold;'>π΄ Needs Init</span>", unsafe_allow_html=True)
|
| 217 |
+
st.sidebar.markdown("**Action:** Go to System Overview")
|
| 218 |
+
st.sidebar.markdown("**Click:** Initialize Epic 2 System")
|
| 219 |
+
else:
|
| 220 |
+
st.sidebar.markdown("**Status:** <span class='status-processing'>π‘ Initializing</span>", unsafe_allow_html=True)
|
| 221 |
+
st.sidebar.markdown("**Loading:** Epic 2 System...")
|
| 222 |
|
| 223 |
# Model specifications in sidebar
|
| 224 |
st.sidebar.markdown("---")
|
|
|
|
| 309 |
col1, col2, col3 = st.columns([1, 2, 1])
|
| 310 |
with col2:
|
| 311 |
if not system_manager.is_initialized:
|
| 312 |
+
st.warning("β οΈ **System Needs Initialization** - Click below to process documents and enable querying!")
|
| 313 |
+
|
| 314 |
if st.button("π Initialize Epic 2 System", type="primary", use_container_width=True):
|
| 315 |
initialize_epic2_system()
|
| 316 |
|
| 317 |
# Show demo mode info
|
| 318 |
+
st.info("π **Demo Mode**: Using 10 RISC-V documents for faster initialization (~30 seconds)")
|
| 319 |
st.info("π§ **Architecture**: ModularUnifiedRetriever with all Epic 2 features")
|
| 320 |
+
st.info("π‘ **After initialization**: Use 'Interactive Query' to ask questions!")
|
| 321 |
else:
|
| 322 |
system_status = system_manager.get_system_status()
|
| 323 |
st.success(f"β
Epic 2 System Online - {system_status['documents']} Documents Ready")
|
|
|
|
| 561 |
st.header("π¬ Interactive Query Interface")
|
| 562 |
|
| 563 |
if not system_manager.is_initialized:
|
| 564 |
+
st.error("π« **System Not Initialized** - No documents have been indexed yet!")
|
| 565 |
+
|
| 566 |
+
col1, col2, col3 = st.columns([1, 2, 1])
|
| 567 |
+
with col2:
|
| 568 |
+
st.markdown("""
|
| 569 |
+
### π Quick Start Guide
|
| 570 |
+
1. **Go to System Overview** (first page)
|
| 571 |
+
2. **Click "Initialize Epic 2 System"**
|
| 572 |
+
3. **Wait for document processing** (~30 seconds)
|
| 573 |
+
4. **Return here to start querying!**
|
| 574 |
+
""")
|
| 575 |
+
|
| 576 |
+
if st.button("π Go to System Overview", type="primary", use_container_width=True):
|
| 577 |
+
# This will trigger a rerun and change the page selection
|
| 578 |
+
st.session_state.force_overview = True
|
| 579 |
+
st.rerun()
|
| 580 |
+
|
| 581 |
+
st.info("π‘ **Why initialize?** The system needs to process and index documents before it can answer questions. This demo uses 10 RISC-V technical documents for faster setup.")
|
| 582 |
return
|
| 583 |
|
| 584 |
# Query input section
|
|
|
|
| 620 |
st.header("π Results Analysis Dashboard")
|
| 621 |
|
| 622 |
if not system_manager.is_initialized:
|
| 623 |
+
st.error("π« **System Not Initialized** - No documents have been indexed yet!")
|
| 624 |
+
|
| 625 |
+
col1, col2, col3 = st.columns([1, 2, 1])
|
| 626 |
+
with col2:
|
| 627 |
+
st.markdown("""
|
| 628 |
+
### π Quick Start Guide
|
| 629 |
+
1. **Go to System Overview** (first page)
|
| 630 |
+
2. **Click "Initialize Epic 2 System"**
|
| 631 |
+
3. **Wait for document processing** (~30 seconds)
|
| 632 |
+
4. **Run some queries** in Interactive Query
|
| 633 |
+
5. **Return here to analyze results!**
|
| 634 |
+
""")
|
| 635 |
+
|
| 636 |
+
if st.button("π Go to System Overview", type="primary", use_container_width=True, key="results_to_overview"):
|
| 637 |
+
st.session_state.force_overview = True
|
| 638 |
+
st.rerun()
|
| 639 |
+
|
| 640 |
+
st.info("π‘ **What you'll see here:** Query performance metrics, retrieval analysis, Epic 2 feature effectiveness, and system diagnostics.")
|
| 641 |
return
|
| 642 |
|
| 643 |
# Check if we have query results to analyze
|