问题描述
如果您能帮助我解决 Clarifai API 的问题,我将不胜感激.
I'll be thankful if you can assist me on an issue with Clarifai API.
我使用 API 做了一个简单的人脸检测应用.我遵循了文档,并从我的客户那里运行了以下代码片段:
I made a simple application of Face Detection using the API.I've followed the documentation and from my client I ran the following code snippet:
app.models
.predict(Clarifai.FACE_DETECT_MODEL, this.state.input)
.then((response) => setImageBox(this.calculateBox(response)))
.catch((err) => {
console.log("Clarifai Error:", err);
});
它曾经可以工作到 2 天前.现在我收到一个错误.Chrome Dev Tool 会在 Network->Headers 选项卡上显示:
It used to work until 2 days ago.Now I get an error.Chrome Dev Tool shows me on the Network->Headers tab:
请求网址:https://api.clarifai.com/v2/models/a403429f2ddf4b49b307e318f00e528b/输出请求方式:POST状态码:404 未找到远程地址:54.208.138.170:443推荐人政策:降级时不推荐人
Request URL: https://api.clarifai.com/v2/models/a403429f2ddf4b49b307e318f00e528b/outputsRequest Method: POSTStatus Code: 404 Not FoundRemote Address: 54.208.138.170:443Referrer Policy: no-referrer-when-downgrade
在网络上->响应选项卡我得到这个错误对象:
On the Network-> Response tab I get this error object:
{状态":{代码":21200,描述":模型不存在",详细信息":未找到 ID 为a403429f2ddf4b49b307e318f00e528b"的模型.检查您的请求的网址.",req_id":2fc7d5ed414a48eead697d9bdcf187b7"},输出":[]}
{"status":{"code":21200,"description":"Model does not exist","details":"A model with ID 'a403429f2ddf4b49b307e318f00e528b' not found.Check the url of your request.","req_id":"2fc7d5ed414a48eead697d9bdcf187b7"},"outputs":[]}
我什至尝试重新安装 Clarifai NPM 包,但没有任何改变.当我查看 Clarifai.FACE_DETECT_MODEL 的值时,它确实是 a403429f2ddf4b49b307e318f00e528b 的 ID,但 Clarifai 服务器无法识别.
I even tried to reinstall the Clarifai NPM package but nothing has changed.When I looked the value of Clarifai.FACE_DETECT_MODEL it's indeed the ID of a403429f2ddf4b49b307e318f00e528b but the Clarifai servers don't recognize it.
是否是 Clarifai API 的错误?
Is it a bug of the Clarifai API?
如何解决这个问题?
谢谢,以利
推荐答案
当我使用 perdict 函数 By Model Version ID 时,问题得到解决.
The issue was solved when I used the perdict function By Model Version ID.
因此代码片段如下:
app.models
.predict(
{
id: "a403429f2ddf4b49b307e318f00e528b",
version: "34ce21a40cc24b6b96ffee54aabff139",
},
this.state.input
)
.then((response) => setImageBox(this.calculateBox(response)))
.catch((err) => {
console.log("Clarifai Error:", err);
});
我要感谢 Clarifai 支持团队解决了这个问题.
I would like to thank the Clarifai support team for solving this issue.
注意安全!
这篇关于Clarifai - FACE DETECT - 模型不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!