Giter VIP home page Giter VIP logo

food-lens-backend's Introduction

Firebase Image Analysis and Diet Logging API

Author: Basith

Description

This Flask application provides an API for uploading and analyzing food images using Firebase Firestore and LogMeal API. It also allows logging food items to a diet log collection.

Features

  • Image Upload and Analysis

    • Upload images of food items for nutritional analysis.
    • Preprocess images and send them to LogMeal API to retrieve nutritional data.
  • Diet Logging

    • Add meals with nutritional data to a diet log collection.
    • Retrieve and display the history of scanned food items and diet logs.
  • Chatbot Integration

    • Implement a chatbot using GenerativeAI to respond to user messages.

Requirements

  • Flask
  • firebase-admin
  • Pillow (PIL)
  • requests
  • google.generativeai (Google LLM Library)

Environment Variables

Ensure the following environment variables are set:

  • API_TOKEN: LogMeal API token
  • GEMINI_API_KEY: Gemini API key for GenerativeAI

Usage

  1. Clone the repository:

    git clone https://github.com/MuhammedBasith/food-lens-backend.git
    cd food-lens-backend
  2. Install dependencies:

    pip install -r requirements.txt
  3. Set up environment variables:

    • Create a .env file and define API_TOKEN and GEMINI_API_KEY.
  4. Start the Flask server:

    python server.py

API Endpoints

  • Upload Image

    • POST /api/upload-image: Upload and analyze an image of a food item.
  • Add to Diet Log

    • POST /api/add-to-diet: Log a meal with nutritional data to the diet log.
  • Get Scanned Items History

    • GET /api/get-scanned-items: Retrieve the history of scanned food items.
  • Get Diet Logs for Calendar

    • GET /api/calendar/diet-logs: Retrieve diet logs for display on a user calendar.
  • Chatbot Interaction

    • POST /api/chatbot: Interact with a chatbot to generate responses using GenerativeAI.

License

This project is licensed under the MIT License - see the LICENSE file for details.

food-lens-backend's People

Contributors

muhammedbasith avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.