Spaces:
Runtime error
Runtime error
| 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() |