This Python script creates a password-protected ZIP file using the pyzipper library. It allows you to specify the files to include in the ZIP and set a password for encryption. The resulting ZIP file requires the provided password to access its contents, providing an additional layer of security.
2
stars
0
forks
source link
Exercise: Introduction to SageMaker "AWS Sagemaker" #2
Create A Tech Gadget Customer Support Chatbot
Imagine you own an online store that sells various tech gadgets. You often receive common questions regarding product specifications, return policies, shipping methods, and technical troubleshooting. To streamline customer support and provide immediate assistance, you decide to implement a simple chatbot.
In this exercise you will use Amazon SageMaker to create a chatbot that can respond to customer inquiries about:
1.Product Information (e.g., "Tell me about product X", "Do you have smartwatches?")
2.Shipping Details (e.g., "How long does shipping take?", "What shipping methods are available?")
3.Return Policy (e.g., "What is your return policy?", "How do I return a product?")
4.Technical Support (e.g., "My gadget won’t turn on", "How do I reset my device?")
5.What Your Chatbot Can Do
6.The chatbot should be able to:
Greet the user.
Understand and respond to specific questions about products, shipping, returns, and support.
Provide a default response for unrecognized queries.
Politely end the conversation.
Step 1: Setup SageMaker
1.Click Launch Cloud Gateway in the bottom left corner of the classroom menu.
2.Click Open Cloud Console.
3.In the search bar in the to left side of the screen type, "sagemaker" and click on Amazon SageMaker.
4.From the SageMaker main page create a Notebook instance. Name your notebook but retain all default values. 5.You will need to create a new IAM role during the setup.
to create a notebook instance click on notebook instances in the notebook heading of the menu on the left side of the screen.
STEP 2: SageMaker Notebook Instances****
Once in the Notebooks dashboard, click Create notebook instance to start a Jupyter Notebook environment.
Image of sagemaker main dashboard
SageMaker
7.In the Notebook instance settings you will:
8.enter a name for your notebook instance
9.create an IAM role for your instance (use the default in the wizard)
leave all other items in their default setting
10.Leave the notebook instance settings in default but set the notebook name and create an IAM role
Notebook Instance Settings
Step3: Open the notebook once the status is InService.****
click the Open Jupyter button to run the notebook
Open Jupyter
11. In the notebook click New and select the notebook type conda_python3.
Click New and choose conda_python3
Click New and choose conda_python3
# Simple Customer Support ChatbotCode in python3.11.1
**responses = {
"hi": "Hello! Welcome to TechGadget Support. How can I assist you today?",
"do you have smartwatches": "Yes, we have a variety of smartwatches. You can check them out on our products page.",
"shipping time": "Shipping usually takes 3-5 business days.",
"shipping methods": "We offer standard, expedited, and overnight shipping.",
"return policy": "You can return products within 30 days of receipt for a full refund.",
"how to return": "To return a product, please visit our returns page for a step-by-step guide.",
"won’t turn on": "Make sure your gadget is charged. If it still won’t turn on, you can visit our troubleshooting page.",
"reset device": "To reset your device, hold down the power button for 10 seconds. If that doesn't work, please check the manual for a factory reset.",
"bye": "Thank you for visiting TechGadget. If you have more questions, feel free to ask. Goodbye!"
}
for keyword, response in responses.items():
if keyword in user_input:
return response
return "I'm not sure how to respond to that. Can you try asking something else?"
while True:
user_input = input("You: ")
if user_input.lower() in ["quit", "exit", "bye"]:
print("Bot: Goodbye! If you have any more questions, we're here to help.")
break
Optional Exercise Tasks
Enhance the dictionary with more responses to cover a wider range of common customer questions.
Improve the chatbot's ability to handle variations in how questions are asked.
Implement a feature where if a user says something the bot doesn't understand multiple times, it directs them to a human customer service representative.
Create A Tech Gadget Customer Support Chatbot Imagine you own an online store that sells various tech gadgets. You often receive common questions regarding product specifications, return policies, shipping methods, and technical troubleshooting. To streamline customer support and provide immediate assistance, you decide to implement a simple chatbot.
In this exercise you will use Amazon SageMaker to create a chatbot that can respond to customer inquiries about:
1.Product Information (e.g., "Tell me about product X", "Do you have smartwatches?") 2.Shipping Details (e.g., "How long does shipping take?", "What shipping methods are available?") 3.Return Policy (e.g., "What is your return policy?", "How do I return a product?") 4.Technical Support (e.g., "My gadget won’t turn on", "How do I reset my device?") 5.What Your Chatbot Can Do 6.The chatbot should be able to:
Greet the user. Understand and respond to specific questions about products, shipping, returns, and support. Provide a default response for unrecognized queries. Politely end the conversation.
Step 1: Setup SageMaker 1.Click Launch Cloud Gateway in the bottom left corner of the classroom menu. 2.Click Open Cloud Console. 3.In the search bar in the to left side of the screen type, "sagemaker" and click on Amazon SageMaker. 4.From the SageMaker main page create a Notebook instance. Name your notebook but retain all default values. 5.You will need to create a new IAM role during the setup.
to create a notebook instance click on notebook instances in the notebook heading of the menu on the left side of the screen.
STEP 2: SageMaker Notebook Instances****
Step3: Open the notebook once the status is InService.****
click the Open Jupyter button to run the notebook Open Jupyter
11. In the notebook click New and select the notebook type conda_python3. Click
New
and chooseconda_python3
Click New and choose conda_python3# Simple Customer Support Chatbot Code in python3.11.1
**responses = { "hi": "Hello! Welcome to TechGadget Support. How can I assist you today?", "do you have smartwatches": "Yes, we have a variety of smartwatches. You can check them out on our products page.", "shipping time": "Shipping usually takes 3-5 business days.", "shipping methods": "We offer standard, expedited, and overnight shipping.", "return policy": "You can return products within 30 days of receipt for a full refund.", "how to return": "To return a product, please visit our returns page for a step-by-step guide.", "won’t turn on": "Make sure your gadget is charged. If it still won’t turn on, you can visit our troubleshooting page.", "reset device": "To reset your device, hold down the power button for 10 seconds. If that doesn't work, please check the manual for a factory reset.", "bye": "Thank you for visiting TechGadget. If you have more questions, feel free to ask. Goodbye!" }
def get_bot_response(user_input): user_input = user_input.lower()
while True: user_input = input("You: ") if user_input.lower() in ["quit", "exit", "bye"]: print("Bot: Goodbye! If you have any more questions, we're here to help.") break
Optional Exercise Tasks Enhance the dictionary with more responses to cover a wider range of common customer questions. Improve the chatbot's ability to handle variations in how questions are asked. Implement a feature where if a user says something the bot doesn't understand multiple times, it directs them to a human customer service representative.