Skip to content

synapticsynergy/nlp_sentiment_model_post

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blogging_template

A blogging template to make it faster to share project code for blog posts

Table of Contents

  1. Usage
  2. Requirements
  3. Development
    1. Installing Dependencies
    2. Download & Saving a Model
    3. Serving in Development
    4. Testing

Usage

The purpose of this template is to quickly create projects for devs to experiment with code from my blog posts

Requirements

  • Python 3.8
  • Poetry 1.1
  • Docker

Development

Installing Dependencies

From within the root directory:

poetry install

Download & Save a Trained Tensorflow Model

Before serving in development using docker compose, you must follow the setup steps documented here:

Downloading & Saving a Trained Tensorflow Model README

Serving in Development

Included a minimal example from fastapi to get started with a production server.

To rebuild the api run

docker-compose build

To serve the api locally run

docker-compose up api

To serve the full stack locally run

docker-compose up

Once that runs, you can use the api by going to the following endpoints:

  1. Main Api: http://localhost:8000/
  2. Api Docs (Auto Generated from FastAPI): http://localhost:8000/docs
  3. Tensorflow Serving: http://localhost:8501/v1/models/sentiment_model/metadata
  4. Main Api endpoint returning model inference: http://localhost:8000/text/

Testing

From within the root directory:

poetry run pytest tests

About

Train a basic nlp sentiment model & serve predictions using Tensorflow Serving

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors