import gradio as gr from chatbot_rag import get_answer # import your function def respond(message, history): """ Respond function for Gradio ChatInterface. message: latest user query history: full chat history (list of [user, bot] pairs) """ # Call your RAG pipeline response = get_answer(message) return response # Simple Gradio Chat Interface chatbot = gr.ChatInterface( fn=respond, type="messages", # since your RAG returns plain text title="Harry Potter Wikipedia", description="It might take little long time to response, wait for the MAGIC." ) if __name__ == "__main__": chatbot.launch()