File size: 789 Bytes
70d3fb9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr
from ui.gradio_ui import get_ui       # Main UI structure
from style import custom_css          # Custom CSS for styling

# Import and initialize LangChain RAg chain for lawbot
from modules.lawbot.rag_with_langchain import load_documents, split_documents, create_vectorstore, setup_rag_chain

# Initialize RAg chain once at app startup
documents = load_documents()
docs = split_documents(documents)
vectorstore = create_vectorstore(docs)
qa_chain = setup_rag_chain(vectorstore)

# Gradio app with custom CSS and UI
with gr.Blocks(css=custom_css) as demo:
    get_ui()  # Loads all tabs including PehchaanSetu and others

# Launch the Gradio app
if __name__ == "__main__":
    url = demo.launch()
    print(f"🚀 Saarthi app is running at: {url}")