Curl Clarifai旋度图像识别集成
我正在尝试使用cURL和PHP从Clarifai图像识别中获取标记 在他们的网站上有以下用户指南: 问题更新 我设法得到了有效的响应,结果如下:Curl Clarifai旋度图像识别集成,curl,image-processing,artificial-intelligence,image-recognition,clarifai,Curl,Image Processing,Artificial Intelligence,Image Recognition,Clarifai,我正在尝试使用cURL和PHP从Clarifai图像识别中获取标记 在他们的网站上有以下用户指南: 问题更新 我设法得到了有效的响应,结果如下: { "status": { "code": 10000, "description": "Ok" }, "outputs": [ { "id": "ea68cac87c304b28a8046557062f34a0", "status": { "code": 10000
{
"status": {
"code": 10000,
"description": "Ok"
},
"outputs": [
{
"id": "ea68cac87c304b28a8046557062f34a0",
"status": {
"code": 10000,
"description": "Ok"
},
"created_at": "2016-11-22T16:50:25Z",
"model": {
"name": "general-v1.3",
"id": "aaa03c23b3724a16a56b629203edc62c",
"created_at": "2017-08-09T17:11:39Z",
"app_id": null,
"output_info": {
"message": "Show output_info with: GET /models/{model_id}/output_info",
"type": "concept"
},
"model_version": {
"id": "aa9ca48295b37401f8af92ad1af0d91d",
"created_at": "2016-07-13T01:19:12Z",
"status": {
"code": 21100,
"description": "Model trained successfully"
}
}
},
"input": {
"id": "ea68cac87c304b28a8046557062f34a0",
"data": {
"image": {
"url": "https://samples.clarifai.com/metro-north.jpg"
}
}
},
"data": {
"concepts": [
{
"id": "ai_HLmqFqBf",
"name": "train",
"app_id": null,
"value": 0.9989112
},
{
"id": "ai_fvlBqXZR",
"name": "railway",
"app_id": null,
"value": 0.9975532
},
{
"id": "ai_VSVscs9k",
"name": "terminal",
"app_id": null,
"value": 0.9230834
}
]
}
}
]
}
现在,我尝试使用每个标签:
$response = curl_exec($curl);
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$body = substr($response, $header_size);
$header = substr($response, 0, $header_size);
$rows = explode("\n", $header);
$err = curl_error($curl);
curl_close($curl);
$resp = json_decode( $body, true );
if ($err) {echo $err; } else {
// foreach thought tags, and if tag value is above 93, than show/echo it
}
但我无法读取每个标记,我无法回显任何标记,我只想显示具有上述值的标记名,例如93。尝试:
CURLOPT_CUSTOMREQUEST=>POST
授权:f26b16808e2a440abb5f28b1c00b6nnn号键无括号
然后
CURLOPT\u POSTFIELDS=>{\inputs\:[{\data\:{\image\:{\url\:\\}}]}
它基本上需要匹配此处cURL列中的格式:
您的请求似乎无效。你知道为什么会这样吗?这不是调试服务。展示自己的努力我不知道为什么请求无效,我正在努力两天。谢谢,非常感谢你的回答。我设法得到了有效的回答,我更新了我的问题,你能再看一次吗,也许你能帮我更多。再次感谢您。很抱歉这里的延迟-已经在Clarifai社区论坛上得到了回答,但这里的回答是:$response=json_decode$body,TRUE;对于$i=0$i