nsfw image classification service
Desktop, Classification, Caffe
curl -X PUT http://localhost:8080/services/nsfw -d '{
"description": "nsfw classification service",
"model": {
"repository": "/opt/models/nsfw",
"create_repository": true,
"init":"https://deepdetect.com/models/init/desktop/images/classification/nsfw.tar.gz"
},
"mllib": "caffe",
"type": "supervised",
"parameters": {
"input": {
"connector": "image"
}
}
}'
curl -X POST 'http://localhost:8080/predict' -d '{
"service": "nsfw",
"parameters": {
"input": {},
"output": {
"confidence_threshold": 0.1
},
"mllib": {
"gpu": true
}
},
"data": [
"/data/example.jpg"
]
}'
from dd_client import DD
host = 'localhost'
port = 8080
dd = DD(host,port)
dd.set_return_format(dd.RETURN_PYTHON)
parameters_input = {}
parameters_mllib = {}
parameters_output = {"confidence_threshold":0.1}
data = ["/data/example.jpg"]
sname = 'nsfw'
classif = dd.post_predict(sname,data,parameters_input,parameters_mllib,parameters_output)
// https://www.npmjs.com/package/deepdetect-js
var DD = require('deepdetect-js');
const dd = new DD({
host: 'localhost',
port: 8080
})
const postData = {
"service": "nsfw",
"parameters": {
"input": {},
"output": {
"confidence_threshold": 0.1,
},
"mllib": {
"gpu": true
}
},
"data": [
"/data/example.jpg"
]
}
async function run() {
const predict = await dd.postPredict(postData);
console.log(predict);
}
run()
{
"status": {
"code": 200,
"msg": "OK"
},
"head": {
"method": "/predict",
"service": "nsfw",
"time": 45
},
"body": {
"predictions": [
{
"classes": [
{
"prob": 0.8330243825912476,
"cat": "ok"
},
{
"prob": 0.16697560250759125,
"last": true,
"cat": "nsfw"
}
],
"uri": "/data/example.jpg"
}
]
}
}