SnapChef: Our Hackathon Journey

Inspiration

We were three freshmen - Bhargava, Rishit, and Sooraj - each with a passion for coding but limited experience in building real-world applications. When we heard about the upcoming hackathon, we knew we had to participate, but we wanted our project to make a real difference.

The idea for SnapChef came from our shared struggles with cooking healthy meals on a student budget. We often found ourselves staring at random ingredients in our fridge, unsure of what to make. That's when it hit us: what if we could create an app that could look at our groceries and suggest recipes?

What it does

With less than 24 hours to bring our idea to life, we knew we had to plan carefully. We decided to build a web application using Python and Streamlit for the frontend, leveraging various APIs and AI services for the backend functionality.

Our high-level architecture looked like this:

  1. User Interface: Streamlit
  2. Authentication: Auth0
  3. Image Recognition: AWS Rekognition
  4. Recipe Generation: Perplexity AI
  5. Grocery Store Locator: Google Maps API

How we built it

We divided the work based on our strengths:

  • Rishit focused on setting up the Streamlit interface and integrating Auth0 for user authentication.
  • Sooraj took on the challenge of implementing AWS Rekognition for food detection.
  • Bhargava worked on integrating the Perplexity AI for recipe generation and the Google Maps API for the grocery store locator.

Challenges we ran into

Training Data for AWS Rekognition

One of our biggest challenges was finding suitable training data for AWS Rekognition. We needed a diverse dataset of food images to ensure our app could recognize a wide variety of ingredients. After hours of searching, we stumbled upon a public dataset of food images, but it wasn't perfect. Many images were low quality or mislabeled.

To overcome this, we:

  1. Manually curated a subset of the dataset, ensuring quality and accurate labeling.
  2. Augmented the data by rotating, flipping, and adjusting the brightness of existing images to increase our dataset size.
  3. Used transfer learning techniques to fine-tune a pre-trained Rekognition model, which helped improve accuracy with our limited dataset.

Integrating multiple APIs proved to be a significant challenge. Each API had its own authentication method, rate limits, and data formats. We faced issues like:

  1. Auth0 token expiration causing unexpected logouts.
  2. Perplexity AI sometimes timing out on complex recipe requests.
  3. Google Maps API returning results in a format different from what we expected.

To solve these issues, we implemented:

  1. A token refresh mechanism for Auth0 to prevent sudden logouts.
  2. Retry logic with exponential backoff for Perplexity AI requests.
  3. A custom parser for Google Maps API results to standardize the data format.

Streamlit State Management

As our app grew more complex, managing state across different pages in Streamlit became increasingly difficult. We learned to use Streamlit's session state effectively, creating a centralized state management system that could be accessed and modified from any page.

Accomplishments that we're proud of

1) Advanced Image Recognition: Implemented AWS Rekognition to accurately identify food items from user-uploaded photos.

2) AI-Powered Recipe Generation: Integrated Perplexity AI to create unique, personalized recipes based on detected ingredients and user preferences.

3) Interactive Web Application: Developed a user-friendly interface using Streamlit, allowing for seamless interaction with complex AI technologies.

4) Secure User Authentication: Implemented Auth0 for robust and secure user login and account management.

5)Real-Time Grocery Store Locator: Integrated Google Maps API to help users find nearby stores for missing ingredients.

6) Multi-Page Application Architecture: Created a cohesive multi-page experience within Streamlit, overcoming its stateless nature.

What we learned

Throughout this hackathon, we gained invaluable experience in:

  1. Working with cloud-based AI services like AWS Rekognition.
  2. Integrating multiple APIs into a single application.
  3. Building user-friendly interfaces with Streamlit.
  4. Managing application state in a multi-page web app.
  5. The importance of error handling and graceful degradation in real-world applications.

Most importantly, we learned how to work as a team, leveraging each other's strengths and supporting each other through the challenges.

What's next for SnapChef

We're excited to continue developing this project, improving its accuracy, and adding new features. SnapChef may be helping students and busy professionals around the world to cook healthier, more creative meals with the ingredients they already have.

Macro Tracking and Meal Planning

Users will be able to easily input ingredients and receive real-time nutritional breakdowns, helping them stay on top of their macros. This feature will be designed to be user-friendly, making it accessible even for those who may not have extensive nutritional knowledge. Additionally, we’ll introduce personalized meal planning tools that adapt to users' preferences, dietary restrictions, and goals. This could include curated meal plans that automatically adjust based on users’ feedback and progress, ensuring that nutrition remains a priority.

Community Engagement and Cultural Exchange

Creating a vibrant community is crucial. We envision forums and social features where chefs and cooks can share tips, recipes, and experiences, fostering collaboration and inspiration. Gamifying the experience with challenges and rewards can motivate users to engage more deeply. By highlighting diverse cuisines and cooking traditions, we aim to inspire users from all backgrounds. Collaborations with chefs from various cultures can introduce users to new flavors and cooking methods, enriching the culinary experience.

Personalization

Using AI, we can offer personalized recipe suggestions based on user preferences, past meals, and macro goals. This would help keep the experience fresh and tailored to individual users, enhancing their journey toward culinary exploration and nutritional wellness.

Built With

Share this project:

Updates