Categorygithub.com/CHESSComputing/MLHub
modulepackage
0.1.6
Repository: https://github.com/chesscomputing/mlhub.git
Documentation: pkg.go.dev

# README

MLHub

build status go report card godoc

MLHUb for CHESS

API usage

# upload ML model
curl http://localhost:port/upload \
    -v -X POST \
    -H "Authorization: bearer $token" \
    -F 'file=@/path/model.tar.gz' \
    -F 'model=model' -F 'type=TensorFlow' -F 'backend=GoFake'

# list current models
curl http://localhost:port/models

# download specific model
curl http://localhost:port/models/<model_name>

# predict results for given model for provided file.json input
curl http://localhost:port/predict \
    -v -X POST \
    -H "Authorization: bearer $token" \
    -H "Accept: applicatin/json" \
    -H "Content-type: application/json" \
    -d@/path/input.json

where input.json has the form:
{"input":[1,2,3], "model": "model", "type": "TensorFlow", "backend": "GoFake"}

# upload MNIST model
curl http://localhost:port/upload \
    -v -X POST -H "Authorization: bearer $token" \
    -F 'file=@./mnist.tar.gz' \
    -F 'model=mnist' \
    -F 'type=TensorFlow' \
    -F 'backend=TFaaS'

# predict MNIST image
curl http://localhost:port/predict \
    -v -X POST -H "Authorization: bearer $token" \
    -F 'image=@./img1.png' \
    -F 'model=mnist' \
    -F 'type=TensorFlow' \
    -F 'backend=TensorFlow'

# delete existing model
curl http://localhost:port/delete
    -v -X DELETE \
    -H "Authorization: bearer $token" \
    -H "Content-type: application/json" \
    -d@/path/model.json

where model.json has the form:
{"model": "model", "type": "TensorFlow", "version": "latest"}

# get documentation
curl http://localhost:port/docs/docs

# Functions

GetHandler handles GET HTTP requests, this request will delete ML model in backend and MetaData database.
DocsHandler handles status of MLHub server.
DownloadHandler handles download action of ML model from back-end server via /models/:name?type=TensorFlow&version=123.
ModelsHandler provides information about registered ML models.
Predict function fetches prediction for given uri, model and client's HTTP request.
PredictHandler handles GET HTTP requests.
No description provided by the author
No description provided by the author
Server defines our HTTP server.
Upload function uploads record to MetaData database, then uploads file to server storage, and finally to ML backend.
UploadHandler handles upload action of ML model to back-end server.

# Variables

MLTypes defines supported ML data types.
No description provided by the author
content is our static web server content.
No description provided by the author
No description provided by the author

# Structs

DocParam defines parameters for uri binding.
Record define ML meta record.