The Random Vectorizer API is a production-ready API endpoint that takes a sentence as input and returns a random 500-dimensional array of floats. This project has been developed with considerations for scalability, security, and performance to ensure it meets the requirements of a production environment.
- Docker installed in server.
-
Clone the repository:
git clone https://github.com/bamwani/random-vectorizer.git
-
Navigate to the project directory:
cd random-vectorizer
-
Run the following command to create a virtual environment for the application using Python3-venv:
python3 -m venv venv source venv/bin/activate
-
Update pip and install the reuired libraries using the following command:
pip3 install--upgrade pip pip3 install -r requirements.txt
- Run the folling command to test and start the server:
sh ./start_main_app.sh
This will create a docker image named "random_vectorizer", Run it by using the same name as container name and start the service
-
Clone the repository:
git clone https://github.com/bamwani/random-vectorizer.git
-
Navigate to the project directory:
cd random-vectorizer
-
Run the following command to install the application using docker:
sh ./install.sh
This will create a docker image named "random_vectorizer", Run it by using the same name as container name and start the service
- Start the docker container:
sh ./start_docker.sh
- Send a POST request to the API endpoint using your favorite HTTP client or tool (e.g., cURL, Postman).
POST /vectorize HTTP/1.1 Host: localhost:5000 Content-Type: application/json { "sentence": "This is an example sentence" }
The API will respond with a JSON object containing the random 500-dimensional array of floats.
-
The application uses Gunicorn as the production-ready server. The Gunicorn configuration is defined in the gunicorn_config.py file. You can modify the configuration parameters to customize the server behavior according to your needs.
-
SSL/TLS: By default, the application runs over HTTP. If you want to enable SSL/TLS encryption, you can provide the appropriate SSL/TLS certificate and private key files and configure Gunicorn to use HTTPS. Refer to the Gunicorn documentation for detailed instructions.
- To run the unit tests for the application, execute the following command:
pytest
The tests ensure the functionality of the vectorization process and the expected behavior of the API endpoint.
Contributions are welcome! If you have any suggestions, bug reports, or improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.