Skip to content

Arslan-Mehmood1/Hugging-face-pipeline-deployment-via-Flask-and-Fast-APIs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HuggingFace NLP pipelines deployment

Sentiment-Analysis Pipeline Deployment

  • model = distilbert-base-uncased-finetuned-sst-2-english
  • task = sentiment-analysis

1) FastAPI

The fast_api.py contains the code for deployment via FastAPI.

Start API

uvicorn --host 0.0.0.0 fast_api:app

Inference Example

curl -X POST -H "Content-Type: application/json" -d '{"text":"a beautiful rainy day."}' http://localhost:8000/predict

2) Flask API

The flask_api.py contains the code for deployment via Flask API.

Start API

python flask_api.py

Inference Example

curl -X POST -H "Content-Type: application/json" -d '["a beautiful rainy day."]' http://localhost:8080/predict