import gradio as gr import random import time with gr.Blocks() as demo: chatbot = gr.Chatbot() msg = gr.Textbox("Write your input here") clear = gr.ClearButton([msg, chatbot]) def respond(message, chat_history): user_input = message.lower() # Topic-based responses if "technology" in user_input: bot_message = "Sure, let's talk about technology. What specific aspect are you interested in?" elif "science" in user_input: bot_message = "Science is fascinating! What scientific topic would you like to discuss?" elif "healthcare" in user_input: bot_message = "Healthcare is crucial. How can I assist you in the healthcare domain?" elif "education" in user_input: bot_message = "Education is important. What educational topic are you curious about?" elif "sports" in user_input: bot_message = "Sports are exciting! What sport or team are you a fan of?" else: bot_message = "Welcome! I'm Glo AI. How can I assist you today?" chat_history.append(bot_message) time.sleep(2) # Simulating a brief delay for a more natural conversation return "", chat_history msg.submit(respond, [msg, chatbot]) from chat_app import launch_chat_app launch_chat_app() demo.launch()