Business_Chatbot / add_sample_data.py
Ancastal's picture
Upload folder using huggingface_hub
401b16c verified
#!/usr/bin/env python3
"""
Add sample data to the chatbot database for testing the dashboard.
This script adds realistic business transactions to populate the dashboard.
"""
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), 'src'))
from chatbot import Chatbot
from models import ChatbotRequest
def add_sample_data():
"""Add sample transactions to the database."""
print("πŸ”„ Adding sample data to the database...")
chatbot = Chatbot()
# Sample purchases
purchases = [
"Add a purchase of 10 USB drives from TechMart at €5 each",
"Add a purchase of 5 laptops from Electronics Plus at €800 each",
"Add a purchase of 20 keyboards from Office Supplies Co at €25 each",
"Add a purchase of 8 monitors from TechMart at €200 each",
"Add a purchase of 15 webcams from Electronics Plus at €45 each"
]
# Sample sales
sales = [
"Sold 8 USB drives to ABC Corp at €12 each",
"Sold 3 laptops to XYZ Ltd at €1200 each",
"Sold 12 keyboards to StartupTech at €40 each",
"Sold 5 monitors to Creative Agency at €350 each",
"Sold 10 webcams to Remote Work Solutions at €75 each",
"Sold 6 USB drives to Local Business at €15 each",
"Sold 2 laptops to Consulting Firm at €1100 each"
]
print("πŸ“¦ Adding purchase transactions...")
for purchase in purchases:
try:
request = ChatbotRequest(message=purchase)
response = chatbot.process_message(request)
print(f" βœ… {purchase}")
except Exception as e:
print(f" ❌ Failed: {purchase} - {e}")
print("πŸ’° Adding sales transactions...")
for sale in sales:
try:
request = ChatbotRequest(message=sale)
response = chatbot.process_message(request)
print(f" βœ… {sale}")
except Exception as e:
print(f" ❌ Failed: {sale} - {e}")
chatbot.close()
print("βœ… Sample data added successfully!")
print("πŸš€ You can now launch the GUI to see the populated dashboard:")
print(" python run_gui.py")
if __name__ == "__main__":
add_sample_data()