{"modulePath":"github.com/CHESSComputing/MLHub","version":"v0.4.1","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package main\n\n## Variables\n\n```go\nvar MLTypes = []string{\"TensorFlow\", \"PyTorch\", \"ScikitLearn\"}\n```\nMLTypes defines supported ML data types\n\n```go\nvar StaticDir, StorageDir string\n```\n\n```go\nvar StaticFs embed.FS\n```\ncontent is our static web server content.\n\n```go\nvar Verbose int\n```\n\n## Functions\n\n```go\nfunc DeleteHandler(c *gin.Context)\n```\nGetHandler handles GET HTTP requests, this request will delete ML model in backend and MetaData database\n\n```go\nfunc DocsHandler(c *gin.Context)\n```\nDocsHandler handles status of MLHub server\n\n```go\nfunc DownloadHandler(c *gin.Context)\n```\nDownloadHandler handles download action of ML model from back-end server via /models/:name?type=TensorFlow\u0026version=123\n\n```go\nfunc ModelsHandler(c *gin.Context)\n```\nModelsHandler provides information about registered ML models\n\n```go\nfunc Predict(rec Record, r *http.Request) ([]byte, string, error)\n```\nPredict function fetches prediction for given uri, model and client's HTTP request. Code is based on the following example: [https://golangbyexample.com/http-mutipart-form-body-golang/](https://golangbyexample.com/http-mutipart-form-body-golang/)\n\n```go\nfunc PredictHandler(c *gin.Context)\n```\nPredictHandler handles GET HTTP requests\n\n```go\nfunc PredictJSONInput(uri string, rec Record, r *http.Request) ([]byte, string, error)\n```\n\n```go\nfunc PredictMultipart(uri string, rec Record, r *http.Request) ([]byte, string, error)\n```\n\n```go\nfunc Server()\n```\nServer defines our HTTP server\n\n```go\nfunc Upload(rec Record, r *http.Request) error\n```\nUpload function uploads record to MetaData database, then uploads file to server storage, and finally to ML backend\n\n```go\nfunc UploadHandler(c *gin.Context)\n```\nUploadHandler handles upload action of ML model to back-end server\n\n## Types\n\n```go\ntype DocParams struct {\n\tName string `uri:\"name\" binding:\"required\"`\n}\n```\nDocParam defines parameters for uri binding\n\n```go\ntype Record struct {\n\tModel       string `json:\"model\"`       // model name\n\tType        string `json:\"type\"`        // model type\n\tBackend     string `json:\"backend\"`     // ML backend name\n\tVersion     string `json:\"version\"`     // ML version\n\tDescription string `json:\"description\"` // ML model description\n\tReference   string `json:\"reference\"`   // ML reference URL\n\tDiscipline  string `json:\"discipline\"`  // ML discipline\n\tBundle      string `json:\"bundle\"`      // ML bundle file\n\tUserName    string `json:\"username\"`    // user name\n\tInput       any    `json:\"input\"`       // prediction input\n\tData        []byte `json:\"data\"`        // input data, e.g. image.png\n}\n```\nRecord define ML meta record\n\n","path":"github.com/CHESSComputing/MLHub","name":"main","synopsis":"","isRedistributable":true}
