File size: 597 Bytes
5c98817
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import streamlit as st
from rag_pipeline import QuoteRAG
import json

# Load RAG system
rag = QuoteRAG()

st.title("πŸ“– RAG-Based Quote Retrieval")
st.write("Ask me for quotes (e.g., *quotes about courage by women authors*)")

query = st.text_input("Enter your query:")

if query:
    results = rag.search(query, top_k=5)

    st.subheader("Results (JSON with similarity score 0–1, higher is better):")
    st.json(results)

    # Download option
    json_str = json.dumps(results, indent=2)
    st.download_button("πŸ“₯ Download JSON", json_str, file_name="results.json")