File size: 601 Bytes
44ab0cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from indexer import index_text, answer_query

# Gradio interface function to handle the RAG system
def rag_system(query):
    # Index the input text
    vectorstore = index_text()
    
    # Answer the query based on the indexed text
    answer = answer_query(query, vectorstore)
    
    return answer

# Build the Gradio interface
iface = gr.Interface(
    fn=rag_system, 
    inputs=["text"], 
    outputs="text", 
    title="AI Alignment Bot",
    description="If the model can't answer, it will say sorry I don't know"
)

# Launch the app
iface.launch()