DEV Community

Andrea Grillo
Andrea Grillo

Posted on

Don't waste your food again with AiFame

Overview of My Submission

How many times did you forget to eat you food before expiring? Not only it is a waste of money, but also a waste of food that you could have eaten, used to prepare a dinner with your friends or gifted to someone.

We built a web application called AiFame made for the Microsoft Azure Trial Hackathon on DEV 2022. Don't waste your food again!

AiFame allows you to:

  • Take a picture of your shopping and computer vision algorithms will detect foods automatically
  • Manage your food inventory like modifying quantity and expiration date.

Try it live here!
Try to manage your inventory or scan foods from a test image.

Submission Category:

We chose to participate in the Computing Captains category because the app was deployed using Azure App Service. The container image is saved in the Azure Container Registry.

Link to Code on GitHub

GitHub logo andregri / AiFame

AiFame is Flask application made for the Microsoft Azure Trial Hackathon on DEV 2022

AiFame

AiFame is web application made for the Microsoft Azure Trial Hackathon on DEV 2022. Don't waste your food again!

AiFame allows you to:

  • Take a picture of your shopping and computer vision algorithms will analyze it for you to detect food automatically
  • Manage your food inventory like quantity and expiration date

Try it live here!

output.mp4

Our tech stack

Python LogoDocker LogoAzure LogoGunicorn LogoHTML LogoCSS LogoJS Logo

  • The backend is built with Python Flask and containerized with Docker.
  • Docker images are pushed to Azure Container Registry and deployed with Azure App Service
  • User data are stored in Azure SQL Database
  • Images are uploaded to Azure Storage Account and analyzed with Azure Computer Vision

Authors




Azure Services we used

project diagram

The app deployed with App Service interacts with a SQL database to store user data and a storage blob to store the images uploaded by users.

Whenever an image is pushed to the blob, Azure Computer Vision analyzes it to detect objects bounding box. Then, for each bounding box we used again Computer Vision to obtain the food name of the object.

The CICD pipeline uses both GitHub Actions and Azure App Service.
Every push or pull request on development branch triggers the workflow that builds and tests the application:

# This is a basic workflow to help you get started with Actions

name: ci

# Controls when the workflow will run
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  push:
    branches: [ main, dev ]
  pull_request:
    branches: [ main, dev ]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      - name: Setup Python
        uses: actions/setup-python@v2.3.1
        with:
          # Version range or exact version of a Python version to use, using SemVer's version range syntax.
          python-version: 3.9
          # The target architecture (x86, x64) of the Python interpreter.
          architecture: x64

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
Enter fullscreen mode Exit fullscreen mode

Every push on the main branch, the Docker image is built and pushed automatically to the Azure Container Registry:

on: [push]
name: cd

jobs:
    build-and-deploy:
        runs-on: ubuntu-latest
        steps:
        # checkout the repo
        - name: 'Checkout GitHub Action'
          uses: actions/checkout@main

        - name: 'Login via Azure CLI'
          uses: azure/login@v1
          with:
            creds: ${{ secrets.AZURE_CREDENTIALS }}

        - name: 'Build and push image'
          uses: azure/docker-login@v1
          with:
            login-server: ${{ secrets.REGISTRY_LOGIN_SERVER }}
            username: ${{ secrets.REGISTRY_USERNAME }}
            password: ${{ secrets.REGISTRY_PASSWORD }}
        - run: |
            docker build . -t ${{ secrets.REGISTRY_LOGIN_SERVER }}/aifame --file Dockerfile.prod
            docker push ${{ secrets.REGISTRY_LOGIN_SERVER }}/aifame
Enter fullscreen mode Exit fullscreen mode

In addition to that, it is necessary to enable the "Continuous Deployment" option on App Service as show in the image below:

App Service Continuous Deployment

Below there is the list of all resources we used:

azure resources

Authors

andregri
CaptainMich
Dadigno

Top comments (2)

Collapse
 
harshhhdev profile image
Harsh Singh

Interesting. I love how your project decides to be something more than most of the other projects in the Hackathon, aiming to solve a problem. Good work! and best of luck in this Hackathon :)

Collapse
 
andreagrillo96 profile image
Andrea Grillo

Thank you! I really appreciate it