Skip to content

A TensorFlow model and tiny express server that can classify text as ingredient, instruction, or other.

License

Notifications You must be signed in to change notification settings

julianpoy/ingredient-instruction-classifier

Repository files navigation

Ingredient & Instruction Classifier

This repository contains a TensorFlow model and example express server for classifying sentences as either ingredient, instruction, or other.

This is particularly useful when pulling recipe information from a site (see https://github.com/julianpoy/recipeclipper ).

Usage

The TensorFlow model exists in the model folder. The src/server.js file provides an example of usage.

The example server can easily be spun up with docker-compose.

To use within a node project:

const predict = require('@julianpoy/ingredient-instruction-classifier/src/predict.js');

const sentences = [
  "1 lb all purpose flour",
  "add all purpose flour to mixing bowl",
  "I absolutely love cooking, it's my favorite pastime",
];

const results = await predict(sentences);

// Results is array of arrays:
[
  [float, float, float] // Result for sentence one
  [float, float, float] // Result for sentence two
  ...
];

// Array positions:
// Idx 0: Ingredient
// Idx 1: Instruction
// Idx 2: Non-recipe text

About

A TensorFlow model and tiny express server that can classify text as ingredient, instruction, or other.

Resources

License

Stars

Watchers

Forks

Packages

No packages published