CJ Hauser
commited on
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import random
|
| 2 |
+
|
| 3 |
+
responses = {
|
| 4 |
+
"hello": ["Hi there!", "Hello!", "Hey! How can I help you today?"],
|
| 5 |
+
"how are you": ["I'm just a bot, but I'm doing great!", "I'm doing well, thank you!"],
|
| 6 |
+
"bye": ["Goodbye!", "See you later!", "Take care!"]
|
| 7 |
+
}
|
| 8 |
+
|
| 9 |
+
def chatbot():
|
| 10 |
+
print("Chatbot: Hello! Type 'bye' to end the conversation.")
|
| 11 |
+
|
| 12 |
+
while True:
|
| 13 |
+
user_input = input("You: ").lower()
|
| 14 |
+
|
| 15 |
+
if user_input == "bye":
|
| 16 |
+
print("Chatbot: Goodbye!")
|
| 17 |
+
break
|
| 18 |
+
elif user_input in responses:
|
| 19 |
+
print(f"Chatbot: {random.choice(responses[user_input])}")
|
| 20 |
+
else:
|
| 21 |
+
print("Chatbot: Sorry, I didn't understand that.")
|
| 22 |
+
|
| 23 |
+
chatbot()
|