Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FlavourSwipe

Swipe your way to your next meal. A Tinder-style recipe discovery app that learns your taste and recommends recipes you will actually want to cook.

HackaTUM 2023 Challenge: HelloFresh Frontend: Flutter Backend: Django REST Python 3.10+ License: MIT

FlavourSwipe was built in 24 hours at HackaTUM 2023 for the HelloFresh challenge. You swipe right on recipes you like and left on ones you do not; a content-based recommender learns from those swipes and surfaces new recipes that match your taste. Recipe imagery is generated on the fly with OpenAI's image API.

Demo

FlavourSwipe demo (login, swipe, recipe, weekly plan)

Login screen Swiping through recipes Recipe card Weekly meal plan

Sign in · swipe through recipes · open a recipe · get a weekly meal plan to order

Full-resolution walkthrough: demo video.

Features

  • Swipe to discover - browse a curated set of recipes with a familiar left/right swipe interaction.
  • Personalised recommendations - a content-based engine ranks unseen recipes by similarity to the ones you liked, and away from the ones you disliked.
  • AI-generated recipe images - dishes without a photo get one generated from their name via the OpenAI image API.
  • REST API - a clean Django REST backend the Flutter client talks to.

How it works

 Flutter app  ──HTTP/JSON──►  Django REST API  ──►  SQLite
 (swipe UI)                   (recipes, feedback,    (recipes, ingredients,
                               recommender)           user feedback)
                                   │
                                   └─►  OpenAI image API (recipe images)

The recommender (backend/api/recommender.py) is content-based:

  1. Each recipe is described by its ingredients (plus its text description).
  2. Those descriptions are vectorised with TF-IDF and compared with cosine similarity, giving a recipe-to-recipe similarity matrix.
  3. Aggregated user feedback (likes count as +1, dislikes as -1) re-weights the scores, so recommendations drift toward what you liked and away from what you did not.
  4. The API returns the most similar recipes you have not seen yet.

Tech stack

Layer Technology
Frontend Flutter (Dart)
Backend Python, Django, Django REST Framework
Database SQLite
Recommender scikit-learn (TF-IDF + cosine similarity), pandas
Image generation OpenAI API

Getting started

1. Backend (Django API)

cd backend
pip install -r requirements.txt        # django, djangorestframework, openai, pandas, scikit-learn, requests
python manage.py migrate               # set up the SQLite schema
python manage.py createsuperuser --email admin@example.com --username admin

Seed the database with recipes and generate an image for each (needs an OpenAI API key in your environment):

export OPENAI_API_KEY=sk-...           # Windows PowerShell: $env:OPENAI_API_KEY="sk-..."
python manage.py create_data ../data/Recipes.csv

Run the server:

python manage.py runserver

2. Frontend (Flutter app)

cd FlavourSwipe
flutter pub get
flutter run                            # pick a connected device or emulator

Point the app at your backend URL if it is not running on the default localhost.

API reference

Base URL: http://localhost:8000/api

Method Endpoint Description
GET /recipe/ List all recipes
GET /ingredient/ List all ingredients
POST /like/<recipeId>/ Record a like for a recipe
POST /dislike/<recipeId>/ Record a dislike for a recipe
GET /recommend/<recipeId>/<excludeRecipeIds>/ Recommend one similar recipe
GET /recommendation/ Get 5 recommended recipes you have not seen

For /recommend/, pass a random recipeId on the first call and the current recipe id thereafter; excludeRecipeIds is a comma-separated list of recipe ids already shown. The response is a similar recipe as JSON.

Management commands

python manage.py create_data ../data/Recipes.csv   # import recipes + generate AI images
python manage.py clear_feedback                    # reset all swipe feedback
python manage.py clear_recipes                     # remove all recipes

Project structure

backend/            Django project
  api/              recipes, ingredients, feedback models, serializers, views,
                    recommender.py, and management commands (create_data, ...)
  flavourswipe/     Django settings / URLs / WSGI
  manage.py
FlavourSwipe/       Flutter app (lib/, assets/, android/, ios/)
data/Recipes.csv    recipe dataset used to seed the backend
docs/screenshots/   app screenshots, team photo, and the demo recording

Team

The FlavourSwipe team at HackaTUM 2023

Built at HackaTUM 2023 (November 17-19) by Manuel Kienlein, Ivan Lomakov (@LivanKov), Jakob Semmler, and Julia (@JoulesSpace).

License

Released under the MIT License.

Acknowledgments

  • HelloFresh for the hackathon challenge.
  • HackaTUM 2023 organisers.
  • The open-source Flutter, Django REST Framework, scikit-learn, and pandas communities.

About

Tinder-style recipe discovery app that learns your taste from swipes and recommends recipes you'll want to cook. Flutter + Django REST, content-based recommender, AI-generated recipe images. Built at HackaTUM 2023 (HelloFresh challenge).

Topics

Resources

Stars

Watchers

Forks

Releases

Used by

Contributors

Languages