Spaces:
Running
Running
Create app.py
Browse filesCreate app.py.
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from rag_engine import process_query
|
3 |
+
from utils import setup_all_auth
|
4 |
+
|
5 |
+
st.set_page_config(page_title="Indian Spiritual RAG")
|
6 |
+
|
7 |
+
# Setup all authentication
|
8 |
+
setup_all_auth()
|
9 |
+
|
10 |
+
st.title("Indian Spiritual Texts Q&A")
|
11 |
+
query = st.text_input("Ask your question:")
|
12 |
+
top_k = st.slider("Number of sources:", 3, 10, 5)
|
13 |
+
word_limit = st.slider("Word limit:", 50, 500, 200)
|
14 |
+
|
15 |
+
if st.button("Get Answer"):
|
16 |
+
if query:
|
17 |
+
with st.spinner("Processing..."):
|
18 |
+
result = process_query(query, top_k=top_k, word_limit=word_limit)
|
19 |
+
|
20 |
+
st.subheader("Answer:")
|
21 |
+
st.write(result["answer_with_rag"])
|
22 |
+
|
23 |
+
st.subheader("Sources:")
|
24 |
+
for citation in result["citations"].split("\n"):
|
25 |
+
st.write(citation)
|