✈ Smart Plate: From Idea to Intelligent Catering
The Spark: Tackling Airline Waste 💡
Our journey with "Smart Plate" began with a seemingly simple but impactful problem: waste in airline catering. We saw an opportunity to leverage technology not just to track inventory, but to intelligently predict consumption, optimize stock levels, and ultimately make airline operations smarter and more sustainable. The vision was clear: create a web application that could manage expiration dates, predict needs for upcoming flights, and even offer insights through an AI assistant.


Laying the Foundation: Building the Interface 🖥

We started with the frontend, sketching out the user experience across several key pages:

  • A visually engaging Homepage (index.html) to set the scene – getting that background video (hero_video.mp4) to look right without weird white borders took some CSS wrangling!
  • An Expiration Adding page (exp_adding.html) focused on inventory management.
  • A visual Expiration Dashboard (exp_dashboard.html) to quickly see product statuses.
  • A Pre-Flight Prediction page (pre_flight_predictions.html) where users could input flight details.

Establishing this structure felt like progress, but getting the navigation and layout consistent across pages required careful attention, especially with the sticky navbar. Organizing our images (gategroup_logo.jpg, gemini_logo.png) and video into a media_files folder early on proved to be a smart move for future scalability.


The Core Challenge: Scanning and Predicting Barcodes 🔍 & 🔮

The real technical hurdles began with the core features. For exp_adding.html, we integrated QuaggaJS for barcode scanning. This was tougher than expected. We battled NPM dependency issues and frustrating errors like "Quagga is not defined" simply because the quagga.min.js file wasn't being served correctly by our backend. Optimizing the scanner's reliability required tweaking configurations and handling camera permissions – a significant learning curve. The goal was to seamlessly check barcodes against our Snowflake database via the backend and even use Eleven Labs to provide audio feedback if a product wasn't found.

Simultaneously, we built the pre_flight_predictions.html form. This involved complex frontend validation – ensuring Flight IDs had the right length, Origin codes were short, Flight Types and Service Types matched specific allowed values (case-insensitive!), and Passenger Counts were within range. A major step was implementing the "Add Product" feature, dynamically building lists of products and their costs, and then packaging it all correctly into the JSON format ({"product_name": [...], "unit_cost": [...]}) needed by our backend's prediction model.


The Brain: Connecting to the Backend 🧠

This is where things got really interesting (and sometimes frustrating!). We chose FastAPI for our Python backend (simple_main.py). Setting it up involved:

  • Defining Pydantic models to structure the data coming from the frontend (like PredictRequest, BarcodeRequest, ChatMessageRequest).
  • Creating API endpoints (/api/check_barcode, /api/save_product, /api/predict, /api/chat) to handle requests.
  • Integrating our SnowflakeFinal.py manager for database interactions.
  • Connecting to elevenlabs_manager.py for text-to-speech.

Actually running the backend was a whole adventure. We learned the importance of virtual environments (venv), battled Windows Execution Policy errors just to activate it, and debugged ModuleNotFoundError and NameError issues caused by incorrect file paths or code order (like the logger definition!). Seeing errors like ERR_CONNECTION_REFUSED or 404 Not Found when the frontend tried to fetch data taught us crucial lessons about ensuring the backend server was actually running and that the frontend was calling the correct URL (http://127.0.0.1:8000/...).


The Intelligence: Machine Learning & AI Chat 🤖📊

A core part of Smart Plate is its predictive capability. We integrated our pre-trained Random Forest Regression model (aidata.Random_Forest_Regression) into the /api/predict endpoint. Handling the data – cleaning it, selecting features, and training the model to achieve our target accuracy of over 98% – was a significant data science challenge undertaken by the team. Loading this model (.joblib file) correctly within the FastAPI app was another integration step.

We also added a Gemini-powered chatbot for user assistance. Integrating the google-generativeai library, loading the API key securely from a .env file, and creating the /api/chat endpoint went smoothly initially. However, getting Gemini to respond exactly how we wanted required iterative prompt engineering. We struggled with overly verbose answers, unwanted formatting (like markdown lists), and ensuring Gemini used the context we provided (CSV column names, file lists). We even encountered puzzling empty responses, likely due to Google’s safety filters, which required more debugging and prompt adjustments. Making the backend load the CSV data and dynamically inject relevant parts (like unique product names when asked) into the prompt was key to making the chatbot truly useful.


Reaching the Cloud: Deployment Hurdles ☁

Taking Smart Plate from our local machines to the real world presented its own set of challenges. Deploying the application using Docker containers and getting everything orchestrated correctly on AWS involved overcoming configuration issues, managing environment variables securely, and ensuring seamless communication between the containerized frontend and backend services.


Lessons Learned 🎓

This project was a deep dive into full-stack development and AI integration. Key takeaways include:

  • Clear Communication is Key: Especially when deciding on architecture (like making simple_main.py the final main file) and debugging across frontend/backend boundaries.
  • Persistence Pays Off: Debugging cryptic errors (like CORS, Failed to fetch, NameError, or silent Gemini blocks) requires patience and systematic troubleshooting using browser dev tools and backend logs.
  • Environment Matters: Properly managing Python virtual environments and Node dependencies prevents countless headaches.
  • Prompt Engineering is an Art: Getting the desired output from LLMs like Gemini requires precise, iterative instruction.
  • Integration is Complex: Making disparate parts (Frontend JS, QuaggaJS, FastAPI, Snowflake, Eleven Labs, Gemini, ML Model, Docker, AWS) work together seamlessly is where the real challenge lies.

Looking Back: A Smarter Plate 🍽

From the initial spark to a deployed application, building Smart Plate was a challenging but incredibly rewarding experience. We faced technical hurdles at almost every step, from basic CSS layouts to complex AI integrations and cloud deployment. But through collaboration and persistence, we created a tool that not only fulfills our initial vision but also taught us invaluable lessons about modern web development and the practical application of AI. We're proud of Smart Plate and excited about its potential to make airline catering significantly more efficient.

Built With

Share this project:

Updates