Skip to main content

Main backend module, which is used for developing web-app logic and deploying AI model.

Project description

ANNHUB Python library

Main backend module, which is used for developing web-app logic and deploying AI model by just a few lines of code.

Usage

We develop a RESTful web controller into a reusable library between many AI models. With these functionalities: Input model, Define data input, logging, exception handler.

Installing

Delivering and versioning as a PyPi package. Install and update using pip:

$ pip install annhub-python

A simple example

from annhub_python import PyAnn

app = PyAnn()

# Define the expected AI model
app.set_model("D:\ARI\ANSCENTER\TrainedModel_c++.ann")

# Define which model ID will be used
app.set_model_id(5122020)

# Define the input corresponding to the choosen model
app.set_input_length(4)

if __name__ == "__main__":
    app.run()

API

The library will product two APIs: health checking, predicting as well as a Swagger UI for API documentation.

GET: /api/v1/health
POST: /api/v1/predict

Swagger UI

Detailed Example

Iris Prediction server

In this example, we illustrate how to develop a server by using AI model powered by ANNHUB with only few steps. You can use this link to access our code. The procedure of using our library to server AI model is as follows:

  1. Put a trained model into your project folder.
  2. Create main.py file, where some key information will be determined such as model path, model id, input length,...
  3. Create Dockerfile to containerize your application. (We recommend to reuse our Dockerfile).
  4. Create docker-compose.yml file, which will construct your docker container by a simple command line. (We also recommend to use as our instruction)
  5. Run your application be a simple command line:
docker-compose up -d
  1. With default settings, your AI can be used at http://localhost:8080. You can access http://localhost:8080/docs to use your Swagger UI documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

annhub_python-0.1.6.tar.gz (56.3 kB view hashes)

Uploaded Source

Built Distribution

annhub_python-0.1.6-py3-none-any.whl (57.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page