Sure, here is the code I used with help from you and E1Cid.
I have a trigger connected the incoming USB camera stream which sends the buffer into a base64 conversion. That goes into the code which adds it into the right place and is passed into the HTML request node. I have a debug for the whole object and the specific variable which tells you the best guess at what is in the photo.
I really hope someone else will find this useful.
[
{
"id": "a8dbc0c2.d3946",
"type": "usbcamera",
"z": "197403af.63076c",
"filemode": "0",
"filename": "capture.jpg",
"filedefpath": "1",
"filepath": "/home/pi/Pictures",
"fileformat": "jpeg",
"resolution": "2",
"name": "",
"x": 150,
"y": 140,
"wires": [
[
"2c052f51.71dc2",
"90abc5f1.29d9d8"
]
]
},
{
"id": "a9c4b431.b8e6d8",
"type": "inject",
"z": "197403af.63076c",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 120,
"y": 40,
"wires": [
[
"a8dbc0c2.d3946"
]
]
},
{
"id": "2c052f51.71dc2",
"type": "image viewer",
"z": "197403af.63076c",
"name": "",
"width": 160,
"data": "payload",
"dataType": "msg",
"x": 90,
"y": 240,
"wires": [
[]
]
},
{
"id": "233bb9c0.96ff4e",
"type": "http request",
"z": "197403af.63076c",
"name": "",
"method": "use",
"ret": "obj",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": false,
"proxy": "",
"authType": "",
"x": 690,
"y": 140,
"wires": [
[
"29dbcf2d.703528",
"dc9b4b4b.53e8d8"
]
]
},
{
"id": "29dbcf2d.703528",
"type": "debug",
"z": "197403af.63076c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload.outputs[0].data.concepts[0].name",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 780,
"y": 240,
"wires": []
},
{
"id": "79b1979c.9de228",
"type": "function",
"z": "197403af.63076c",
"name": "Compose Call to Clarifai",
"func": "// insert base64 image into payload\nvar b64 = msg.payload; \nmsg.headers = {};\nmsg.payload ={};\nmsg.inputs={};\nmsg.method = \"POST\";\n// Add your own key\nmsg.headers[\"Authorization\"] = 'Key YOUR_KEY';\nmsg.headers[\"Content-Type\"] = \"application/json\";\nmsg.payload = {\n \"inputs\": [\n {\n \"data\": {\n \"image\": {\n \"base64\": b64\n }\n }\n } \n ]\n };\n// This model number is the general model - change this for other models\nmsg.url =\"https://api.clarifai.com/v2/models/aaa03c23b3724a16a56b629203edc62c/outputs\";\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 470,
"y": 140,
"wires": [
[
"233bb9c0.96ff4e"
]
]
},
{
"id": "dc9b4b4b.53e8d8",
"type": "debug",
"z": "197403af.63076c",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 920,
"y": 140,
"wires": []
},
{
"id": "90abc5f1.29d9d8",
"type": "base64",
"z": "197403af.63076c",
"name": "Convert Picture to Base64",
"action": "str",
"property": "payload",
"x": 370,
"y": 280,
"wires": [
[
"79b1979c.9de228"
]
]
}
]