Giter Site home page Giter Site logo

bamwani / random-vectorizer Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 7 KB

Random Vectorizer API: Production-quality endpoint for generating random 500-dimensional arrays of floats from input sentences. However, this repo focuses on deployment of a Flask application in Production.

License: MIT License

Dockerfile 10.87% Python 79.03% Shell 10.10%
deployment docker dockerfile flask flask-cors flask-security production venv-python flask-production production-deployment

random-vectorizer's Introduction

Random Vectorizer API

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.

Pre-requisites (for Production deployment):

  1. Docker installed in server.

Installation - Development

  1. Clone the repository:

    git clone https://github.com/bamwani/random-vectorizer.git
    
  2. Navigate to the project directory:

    cd random-vectorizer
    
  3. Run the following command to create a virtual environment for the application using Python3-venv:

    python3 -m venv venv
    source venv/bin/activate
  4. Update pip and install the reuired libraries using the following command:

    pip3 install--upgrade pip
    pip3 install -r requirements.txt
    

Usage - Development

  1. 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

Installation - Production (using Docker)

  1. Clone the repository:

    git clone https://github.com/bamwani/random-vectorizer.git
    
  2. Navigate to the project directory:

    cd random-vectorizer
    
  3. 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

Usage - Production (using Docker)

  1. Start the docker container:
    sh ./start_docker.sh
    
  2. 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.

Configuration

  1. 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.

  2. 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.

Running Tests:

  1. 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.

Contributing

Contributions are welcome! If you have any suggestions, bug reports, or improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

random-vectorizer's People

Contributors

bamwani avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.