import gradio as gr def law_bot(message, history): if message.endswith("Hi"): return "Yes, my lordship? Do you have a question?" else: return "Look at you sir; no greetings for us lowly bots?" if history("Hi"): return "Greetings of the day, sir! How may i help you?" demo = gr.ChatInterface( law_bot, chatbot=gr.Chatbot(height=100), textbox=gr.Textbox(placeholder="Ask me a question of law", container=False, scale=4), title="LawBot", description="Ask me a legal question", theme="gradio/monochrome", examples=["What is Habeas Corpus?", "What is Mandamus?", "What is Certiorari?"], cache_examples=True, retry_btn=None, undo_btn="Delete Previous", clear_btn="Clear", show_progress="full", ) demo.launch()