GithubHelp home page GithubHelp logo

ajaman190 / ai-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from samagra-development/ai-tools

0.0 0.0 0.0 1.13 MB

AI Tooling to bootstrap applications fast

Shell 11.19% Python 81.01% Dockerfile 7.80%

ai-tools's Introduction

AI Toolchain

AI Toolchain is a collection of tools for quickly building and deploying machine learning models for various use cases. Currently, the toolchain includes a text translation model, and more models may be added in the future.

Prerequisites

Setup

AI-Tools Models at present can be packaged and deployed in two ways:

  • As a Single Image
  • Multiple Images

Single Image

In single image setup, we have a single quart app hosting all the models. It is bundled as a single Docker Image. All models can be accessed following this path convention http://domain_name/<use_case>/<provider>/<mode>

Services are usually provided in either remote mode or local mode.

For example, the text_translation service provided by google can be accessed on your local system at this URL: http://localhost:8000/text_translation/google/remote

Deploy Single Image Setup

docker build -t <image-name> .
docker run -p <host_port>:<container_port> <image-name>

Multiple Image

In Multi Image Setup, each model has its own quart application and docker image. All model APIs are served via NGINX by utilizing proxies to route incoming requests to the appropriate destinations.

There won't be any difference in accessing the models. The text_translation service provided by google can still be accessed on your local system at this endpoint: http://domain_name/text_translation/google/remote

Deploy Multi Image Setup

For mutliple image setup, the docker-compose file and nginx configuration files are generated dynamically based on the config.json file. The following commands might require sudo privileges.

Run this script to generate the configuration files.

./generate.sh

Setup NginX configuration

sudo cp <DOMAIN_NAME>.conf /etc/nginx/conf.d/
nginx -t //Checks for configuration errors
sudo nginx -s reload
  • For Windows copy to C:\nginx\conf\ and reload the server.
  • For MacOS copy to /usr/local/etc/nginx/ and reload the server.

The .conf file will be present in your project root path after running the generate.sh script.

Build Image

docker-compose -f ./docker-compose-generated.yaml build
docker-compose -f docker-compose-generated.yaml up

Adding a new model locally

To add a new model you need to create sub-directory in src. The subdirectory will follow use_case/provider/mode format.

To deploy your application, the dockerfile must:

  • copy program files
  • install requirements
  • build and run the application

After you have developed and dockerized the application, to add a new model, you need to add a key pair inside models object in the config file with the following properties:

  • serviceName : Name of the service. This will also be the docker image's name.
  • modelBasePath: Dockerfile location of your model.
  • apiBasePath: Endpoint from where you wish to access the model. Should follow this convention: <use_case>/<provider>/<mode>.
  • containerPort: Port at which the application will be hosted inside the container.
  • environment: Another JSON object with key-value pairs. Should contain any relevant secrets or API_KEYS required to run the application.

For example, if you want to add a new Text Translation AI Model from OPENAI in remote mode, you need to do as follows:

{
      "serviceName": "text_translation_google",
      "modelBasePath": "src/text_translation/google/remote/.",
      "apiBasePath": "text_translation/google/remote",
      "containerPort": 8000,
      "environment": {
        "OPENAI_API_KEY": "${OPENAI_API_KEY}",
        "GOOGLE_CLOUD_SECRET": "${GCP_SECRET}"
      }
}

Contributing

Contributions to AI Toolchain are welcome! To contribute, please follow these guidelines:

  1. Fork the repository and create a new branch for your feature or bug fix.
  2. Write tests for your changes.
  3. Submit a pull request describing your changes and why they are needed.

Thank you for considering contributing to AI Toolchain!

ai-tools's People

Contributors

chakshugautam avatar singhalkarun avatar psn0w avatar manas23601 avatar tushar5526 avatar gautamr-samagra avatar nitesh639 avatar djgupta avatar sanjaysinghrajpoot 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.