import gradio as gr from indexer import index_text, answer_query # Gradio interface function to handle the RAG system def rag_system(query,history): # Index the input text vectorstore = index_text() # Answer the query based on the indexed text answer = answer_query(query,history, vectorstore) return answer iface = gr.ChatInterface( rag_system, type="messages", chatbot=gr.Chatbot(height=600,placeholder="Let's understand AI Alignment"), title="AI Alignment ChatBot", textbox=gr.Textbox(placeholder="Ask Anything", container=True, scale=10), theme="Origin", examples=["What is Orthogonality Thesis?"] ) # Launch the app iface.launch()