File size: 762 Bytes
c805c5c
7321078
dad7dc2
cf1b384
d3a5f30
cf1b384
 
 
 
 
dad7dc2
cf1b384
 
 
 
 
c805c5c
cf1b384
 
 
 
 
 
489ee28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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)