Welcome to the NLP API Boilerplate
This is a Python-based boilerplate project for Natural Language Processing (NLP) tasks. It comes pre-configured with components that can be useful for starting a NLP project.
-
FastAPI: REST API using FastAPI (high-performance web framework for building APIs in Python) - user authentication and authorization (JWT - JSON Web Token).
-
Postgres: relational data storage.
-
Elasticsearch: distributed search and analytics engine, to store and retrieve textual data efficiently.
-
Redis Caching: caching, a fast in-memory data store - improve the performance of your NLP application.
-
Docker / Docker Compose: container applications using Docker and Docker Compose with hot reloading for faster development cycles - simplify the development and deployment processes.
Follow the instructions below to get the NLP API Boilerplate project up and running on your local machine.
Make sure you have the following software installed:
- Python >= 3.9
- Docker
- Docker Compose
-
Clone the repository:
git clone https://github.com/hugohonda/nlp-api-boilerplate cd nlp-api-boilerplate
-
Create a virtual environment (optional but recommended):
python3 -m venv venv source venv/bin/activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Rename the example env files (
.env.example
->.env
) and update the configuration variables as per your needs.cp .env.example .env
cp ./api/.env.example ./api/.env
To start the NLP Boilerplate application, follow these steps:
-
Using Docker Compose (recommended):
docker-compose up --build
This command will build and start the Docker containers for the application and its dependencies.
-
Alternatively, you can run the application directly:
uvicorn main:app --proxy-headers --host 0.0.0.0 --port 8989 --reload --forwarded-allow-ips '*'
This command will start the application without Docker, but make sure to set up the required services (PostgreSQL, Elasticsearch, and Redis) separately.
Once the application is up and running, you can access it by visiting http://localhost:8989
in your web browser.
The API documentation is available at http://localhost:8989/docs
, providing details about the available endpoints and their usage.
For any questions or inquiries, please contact at
honda . data . science at gmail . com