Skip to content

This is an example project to get started on quickly deploying an NLP service with FastAPI, SpaCy, Docker, Poetry, and your cloud service of choice.

License

Notifications You must be signed in to change notification settings

JayThibs/spacy-example-deployed-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Example NLP Service with SpaCy

This is an example NER service using SpaCy and was built to show Data Scientists & Analysts a quick way to turn their models into deployable services.

Tools used: FastAPI, SpaCy, Docker, and Poetry.

How to use with Docker

git clone https://github.com/JayThibs/spacy-example-deployed-service
cd spacy-example-deployed-service
docker build -t spacy-example-deployed-service .
docker run -d -p 80:80 spacy-example-deployed-service:latest

Using the Swagger UI

Then, head to http:https://localhost/docs to see the docs and test the app by clicking Try It Out, changing content to whatever text you would like to get NERs from with SpaCy, and hitting Execute. Scroll down to find the output entities in the Response body.

On the Swagger UI, you can Try It Out here:

try-it-out-content

Once you've executed the request, you can see the output entities in the Response body:

response-body

If you want to run it locally without Docker

You may need to update the main.py file import the BaseModels. You simply need to remove the period from from .models import Payload, Entities.

Then, you will need to do:

git clone https://github.com/JayThibs/spacy-example-deployed-service
cd spacy-example-deployed-service 
pip install poetry # in case you don't have it
poetry install # install dependencies
uvicorn src.main:app --reload

Now, you can head to http:https://localhost:8000/docs. Go to the previous section for help with the Swagger UI.

References

As a way to get better at quickly deploying useful ml / data science apps, I worked through this reference video walkthrough to get going quickly for future projects.

About

This is an example project to get started on quickly deploying an NLP service with FastAPI, SpaCy, Docker, Poetry, and your cloud service of choice.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published