Skip to content

TheCodingLand/fastTextApi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastTextApi

This is a very simple python api implementation for fastText https://github.com/facebookresearch/fastText.git

It is intended as an small proof of concept of a flask API exposing trained models.

Instructions :

  git clone https://github.com/TheCodingLand/fastTextApi

  cd fastTextApi

  docker build . -t fasttext

  docker run -p 5000:5000 -v fasttext:/data fasttext

open a browser and go to yourdockerhost:5000

I included an example model, named language, with version 0, supervised, quantized :

load the model :

{
  "name": "language",
  "version": 0,
  "supervised": true,
  "quantized": true
}

try the predict post method :

{
  "name": "language",
  "version": 0,
  "text": "reanu keeves is an handsome man",
  "nbofresults": 2
}

returns :

{
  "status": "success",
  "results": [
    {
      "category": "en",
      "confidence": 0.9863510129824254
    },
    {
      "category": "fr",
      "confidence": 0.005755515951242966
    }
  ]
}

you can add your models files into

/var/lib/docker/volumes/fasttext/_data/models/{modelname}/{modelversion}/model.ftz or model.bin

and query them like :

{
  "name": "modelname",
  "version": version,
  "text": "my text to test",
  "nbofresults": x number of results I want
}

This is the minimal working version.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published