File size: 595 Bytes
73c3249
61152f1
 
 
 
 
 
 
 
73c3249
61152f1
 
 
73c3249
 
 
61152f1
 
 
 
 
 
 
73c3249
61152f1
73c3249
61152f1
73c3249
 
61152f1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
from dotenv import load_dotenv
load_dotenv()

import gradio as gr
from ui.gradio_ui import get_ui
from style import custom_css

# Import RAG pipeline
from modules.lawbot.rag_with_langchain import (
    load_documents,
    split_documents,
    create_vectorstore,
    setup_rag_chain
)

def initialize_rag():
    documents = load_documents()
    docs = split_documents(documents)
    vectorstore = create_vectorstore(docs)
    return setup_rag_chain(vectorstore)

qa_chain = initialize_rag()

demo = get_ui(qa_chain)

demo.css = custom_css

if __name__ == "__main__":
    demo.launch()