# This is THE app code. # comment added, to be edited, to trigger HF rebuild import gradio as gr from rag import ask_baba def chat_fn(user_input, chat_history): answer = ask_baba(user_input) # only one argument chat_history = chat_history or [] chat_history.append((user_input, answer)) return chat_history, chat_history with gr.Blocks() as demo: gr.Markdown("# 🙏 Ask Brahmarshi Baba Milind") gr.Markdown("This is a satire demo. All answers are fictional.") chatbot = gr.Chatbot() msg = gr.Textbox(placeholder="Ask your question here ...") msg.submit(chat_fn, inputs=[msg, chatbot], outputs=[chatbot, chatbot]) msg.submit(lambda: "", None, msg) if __name__ == "__main__": demo.launch(share=True, debug=True)