Bharatiya_Nyaya_Sanhita_Chatbot / rag_initializer.py
JohnsonMLEngineer's picture
Upload 8 files
b839ee6 verified
raw
history blame
436 Bytes
import streamlit as st
from document_processor import read_documents, chunk_data
from embeddings_store import create_embeddings_and_store
@st.cache_resource
def initialize_rag_chain():
try:
docs = read_documents("bns3.pdf")
doc_chunks = chunk_data(docs)
return create_embeddings_and_store(doc_chunks)
except Exception as e:
st.error(f"Error initializing RAG chain: {str(e)}")
return None