gpt4 book ai didi

ibm-watson - 使用 Watson 对图像进行分类时 JSON 序列化失败(iOS - Swift)

转载 作者:行者123 更新时间:2023-12-03 12:35:24 25 4
gpt4 key购买 nike

我想创建一个使用相机和照片库的应用程序,让用户可以拍照并分类。我已经配置了我的 Swift 环境,但即使包含来自 Internet 的 URL,也无法对图像进行分类。顺便说一下,我正在使用 https://github.com/watson-developer-cloud/ios-sdk

这是一个简单的代码:

import VisualRecognitionV3

let apiKey = "your-apikey-here"
let version = "YYYY-MM-DD" // use today's date for the most recent version
let visualRecognition = VisualRecognition(apiKey: apiKey, version: version)

let url = "http://blog.fashionsealhealthcare.com/sites/default/files/styles/blog_image_display/public/field/image/blogs/ibm_watson.png"
let success = { classifiedImages in
print(classifiedImages) }
visualRecognition.classify(url: url, success: success)

但是,我收到以下错误:

JSON Serialization Failed. Could not parse the following data.
{
"error": {
"code": 400,
"description": "Invalid output language specified.",
"error_id": "parameter_error"
},
"images_processed": 0
}

有什么问题吗?

提前致谢。

最佳答案

看起来您使用的是 Swift 3.0 版本的 iOS SDK?不幸的是,我们仍在将 SDK 迁移到 Swift 3.0 的过程中,预计在此过程中会出现一些错误和问题。更多Swift 3.0迁移信息,可以关注this issue .

从 v0.8.0 开始,iOS SDK 在 Xcode 8 中与 Swift 2.3 一起工作。我们最近发现使用 Visual Recognition 上传 .png 图像时存在错误,但 .jpg 图像似乎工作正常。

关于ibm-watson - 使用 Watson 对图像进行分类时 JSON 序列化失败(iOS - Swift),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39734954/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com