Skip to content

Node.js, Express, Tesseract | Image to text converter | Created to compare list of ingredients inputted by user to text from photo

Notifications You must be signed in to change notification settings

MusicMeier/ingredient-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ingredient-backend

IngredientCheck

A next level label reader that takes the and extra step by comparing the label to a list.

General Info

IngredientCheck helps usersby scanning labels and checking them against the list of ingredients you input. Does a simple comparison to match ingredients that users want to avoid.
🎶

Inspiration

Through to mhy love of cooking and hosting, I have found that

Intro Video

Backend demo

Technologies

  • Node: version 15.0.1
  • multer: 1.4.2
  • cors: 2.8.5
  • JavaScript: version 1.1.1
  • JSON: version 2.3
  • body-parser: 1.19.0
  • express: 4.17.1
  • nodemon: 2.0.6

Setup

To run this project, create a folder on your local environment where you can clone "ingredient-backend" from GitHub repositories. Open in your code editor.

From your backend folder perform the following commands:
  • Use the command to start your NPM: npm init
  • In your terminal, install express: npm install express
  • You don't want to send your node-modules to github, in terminal: touch .gitignore
  • require express in your index.js folder

  • Use terminal to install multer: npm i multer

  • Use terminal to install cors: npm install cors

  • Use terminal to install ejs: npm install ejs

  • last but not least install Tesseract: npm install tesseract.js

  • *Please note that some features are still a work in progress.

    Instructions

    1. Check out the backend capabilities!
    2. npm start
    3. Go to your browser and go to localhost:7001
    4. Manimulate the string to have ingredients you want it to catch
    5. upload a label and hit convert

    Code Example

    Comparison function:

    function compareStrings(string, photoWords){
      let newString = string.split(' ')
      let updatedphotoWords = photoWords.split(' ')
      let matchingWords = newString.filter(element => updatedphotoWords.includes(element));
      return matchingWords
    }
    

    Async Function to run Tesseract worker that changes photo image file to text:

    (async () => {
      const worker = createWorker();
      await worker.load();
      await worker.loadLanguage('eng');
      await worker.initialize('eng');
      const { data: {text} } = await worker.recognize(image);
      photoWords = text;
      console.log(photoWords = text)
      return compareStrings(string, photoWords);
    })()
    

    Status

    We're looking forward to rolling-out the following features:

  • Connect the Flutter frontend.
  • Graph of percentage to most commonly bought ingredients
  • Save list to database
  • Contact

    Music MeierMusic Meier 🎼

    About

    Node.js, Express, Tesseract | Image to text converter | Created to compare list of ingredients inputted by user to text from photo

    Resources

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published