Skip to content

Example for creating a minimal API using Flask to expose a Python model

Notifications You must be signed in to change notification settings

gabrielpreda/flask_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This is an example of using Flask to create an API for an Python program.

The service is exposing several endpoints as following:

  • GET /status - return the status of the service
  • GET train - train the model IrisModel, from model module
  • POST /species - 2 parameters: sepal_length & petal_length, predict the class by calling the predict function of model module (model is RandomForest)

Source files

The following files are included in the project:

  • model/model.py - module containinin the IrisModel class: train the model, predict using the trianing model
  • app.py - API using Flask; to predict the species, a pretrained model (build in model.py using) is load

Usage

To start the service, run python app.py

About

Example for creating a minimal API using Flask to expose a Python model

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published