Cuppa

Caffe and KNN as a service

View the Project on GitHub flipkart-incubator/Cuppa

Getting Started

Examples

Installing

API

Caffe as a Service

KNN as a service

API Documentation

Caffe Predict:

HTTP Request: POST /v1/caffe_model/predict

Request Body: JSON

{
    "url": image_url,
    "modelId": model_id
}

Response on Success:

A vector of numbers

Response on Failure:

Failure message and error code

KNN Update:

HTTP Request: POST /v1/knn_model/update

Insert

Request Body: JSON

{
 	"modelId": model_id,
 	"operation": "insert",
 	"dataPointId": data_point_id,
 	"vector": Array of data points,
 	"tags": Array of tags
 }

Delete

Request Body: JSON

{
 	"modelId": model_id,
 	"operation": "delete",
 	"dataPointId": data_point_id
 }

Response on Success:

200 OK

Response on Failure:

Failure message and error code

KNN Predict:

HTTP Request: POST /v1/knn_model/predict

SearchById

Request Body: JSON

{
 	"modelId": model_id,
 	"operation": "SearchById",
 	"dataPointId": data_point_id,
	"tags": Array of tags
 }

SearchByVector

Request Body: JSON

{
 	"modelId": model_id,
 	"operation": "SearchByVector",
 	"vector": Array of numbers,
	"tags": Array of tags
 }

Response on Success:

{
  status: success
  result: Top K nearest neighbours(Data point Ids) with distances
}

Response on Failure:

Error code and failure message

Router Map update:

HTTP Request: POST /v1/model_workers_map

Request Body: JSON

{
    "Caffe": {
        model_id_1 : [{
			"host": host_name,
			"port": port_number,
			"local_worker_id": local_worker_id
		},{
			"host": host_name,
			"port": port_number,
			"local_worker_id": local_worker_id
		}]
        model_id_2 : [{
			"host": host_name,
			"port": port_number,
			"local_worker_id": local_worker_id
		}]
              .
              .
              .
	}
    "KNN":{
        model_id_3 : [{
			"host": host_name,
			"port": port_number,
			"local_worker_id": local_worker_id
		}]
        model_id_4 : [{
			"host": host_name,
			"port": port_number,
			"local_worker_id": local_worker_id
		}]
              .
              .
              .
	}
}

Response on Success:

HTTP Response 200 OK.