dnj0 commited on
Commit
3340ad6
Β·
verified Β·
1 Parent(s): 16d4eab

Update src/app.py

Browse files
Files changed (1) hide show
  1. src/app.py +8 -5
src/app.py CHANGED
@@ -1,4 +1,3 @@
1
-
2
  import streamlit as st
3
  import os
4
  from pathlib import Path
@@ -59,7 +58,6 @@ st.title("πŸ“„ Multimodal RAG LLM System (PDF Parsing)")
59
  with st.sidebar:
60
  st.header("βš™οΈ Configuration")
61
 
62
- # API Key Section
63
  st.subheader("πŸ”‘ OpenAI API Key")
64
 
65
  api_key = st.text_input(
@@ -91,6 +89,7 @@ with st.sidebar:
91
  try:
92
  info = st.session_state.vector_store.get_collection_info()
93
  st.metric("Items in Store", info['count'])
 
94
  st.caption(f"Path: {info['persist_path']}")
95
  except Exception as e:
96
  st.error(f"Error getting store info: {e}")
@@ -313,10 +312,14 @@ if st.button("πŸ” Search & Generate Answer"):
313
 
314
  st.subheader("πŸ“ Answer")
315
 
316
- col1 = st.columns(1)
317
  with col1:
 
 
318
  st.metric("Sources Used", result['sources_used'])
319
-
 
 
320
 
321
  st.write(result['answer'])
322
 
@@ -339,4 +342,4 @@ if st.button("πŸ” Search & Generate Answer"):
339
  print(f"Error: {e}")
340
 
341
 
342
- st.divider()
 
 
1
  import streamlit as st
2
  import os
3
  from pathlib import Path
 
58
  with st.sidebar:
59
  st.header("βš™οΈ Configuration")
60
 
 
61
  st.subheader("πŸ”‘ OpenAI API Key")
62
 
63
  api_key = st.text_input(
 
89
  try:
90
  info = st.session_state.vector_store.get_collection_info()
91
  st.metric("Items in Store", info['count'])
92
+ st.metric("Status", info['status'])
93
  st.caption(f"Path: {info['persist_path']}")
94
  except Exception as e:
95
  st.error(f"Error getting store info: {e}")
 
312
 
313
  st.subheader("πŸ“ Answer")
314
 
315
+ col1, col2, col3 = st.columns(3)
316
  with col1:
317
+ st.metric("Confidence", f"{result['confidence'].upper()}")
318
+ with col2:
319
  st.metric("Sources Used", result['sources_used'])
320
+ with col3:
321
+ if result['sources_used'] > 0:
322
+ st.metric("Avg Relevance", f"{sum(1-r.get('distance',0) for r in search_results)/len(search_results):.0%}")
323
 
324
  st.write(result['answer'])
325
 
 
342
  print(f"Error: {e}")
343
 
344
 
345
+ st.divider()