import gradio as gr # Simple rule-based chatbot logic def chatbot_response(message): message = message.lower() if any(word in message for word in ["shipping", "deliver", "arrive"]): return "Shipping usually takes 3-5 business days. You'll receive a tracking number via email." elif any(word in message for word in ["return", "refund", "send back"]): return "You can return the SmartHome Hub Pro within 30 days of delivery." elif any(word in message for word in ["product", "smarthome", "hub"]): return "The SmartHome Hub Pro is an AI-powered device that connects and automates all your smart home gadgets." elif any(word in message for word in ["issue", "problem", "trouble", "not working"]): return "Try restarting the device. If problems persist, contact our support team at support@smarthomepro.com." elif message in ["exit", "quit", "bye"]: return "Goodbye! Thanks for chatting with us." else: return "I'm not sure how to help with that. Can you ask about shipping, returns, or the product?" iface = gr.Interface( fn=chatbot_response, inputs=gr.Textbox(placeholder="Ask me about the SmartHome Hub Pro..."), outputs="text", title="Tech Gadget Chatbot", description="Ask about product features, returns, or shipping." ) if __name__ == "__main__": iface.launch()