import gradio as gr def chat_function(message, history): response = f"Hello! You said: {message} \nI am Maged AI ❤️" history = history + [(message, response)] return history, "" with gr.Blocks(title="Maged AI") as demo: gr.Markdown("# Maged AI - Your Smart Assistant 🤖") chatbot = gr.Chatbot(height=400) msg = gr.Textbox(placeholder="Type your message here...") clear = gr.Button("Clear") msg.submit(chat_function, [msg, chatbot], [chatbot, msg]) clear.click(lambda: ([], ""), None, [chatbot, msg]) demo.launch(server_name="0.0.0.0", server_port=7860)