Spaces:
Sleeping
Sleeping
File size: 1,368 Bytes
f3afae8 |
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 26 27 28 29 30 |
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 [email protected]."
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()
|