Skip to content
This repository has been archived by the owner on Oct 11, 2022. It is now read-only.

teamMay/project_3A

Repository files navigation

MAY - Project ECM 3A 2021

This is a project for students from Ecole Centrale Marseille aiming to discover sentiment analysis through different methods and serve an AI model via an API.

Sentiment analysis served through a web API

For local development, we use FastAPI directly.

For production means, we can use FastAPI in pair with Traefik.

Local install

You need python (3.6+), pip and python3-venv installed.

If python isn't installed on your machine, follow official documentation.

If you're only missing pip:

# unix
sudo apt install python3-pip

python3-venv:

# unix
sudo apt install python3-venv

First, let's install pipx and poetry.

# pipx
pip3 install pipx
python3 -m pipx ensurepath
python3 -m pipx completions

# poetry
pipx install poetry
# You may need to restart your terminal for poetry to be taken into account

Finally, we can install our dependencies:

poetry install

Run

To launch uvicorn (application server), use:

cd app
uvicorn main:app --reload

With poetry managing your installation:

poetry run uvicorn app.main:app --port 8080 --reload

You can now browse to your fastapi website.

This should lead you to an error page since we haven't defined anything on the root of our application.

However, FastAPI comes with auto documentation. Browse to the documentation page and you can enjoy you first route ready to go !

So far, only one API route has been defined: http://localhost:8080/sentiment-analysis

Testing

cd app
poetry run pytest

Going further

I chose FastAPI because it's... fast ! You get documentation out of the box, validation etc etc with minimum configuration.

From here, you can:

  • Use your own models and algorithms within existing routes or create new ones
  • Deploy this website to a production server
  • Try others alternatives like https://www.deploymachinelearning.com/ (django, docker, AB testing)
  • Decide to create a frontend website (with React, Vue, Svelte or whatever framework) to consume your API

Feel free to reach me out at: [email protected]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published