我将比较一些情绪检测应用程序。我想设计一个简单的 C# 应用程序来使用内置代码或内置库测试大量图像的情感。我们可以从谷歌云 api 下载用于情绪检测的 c# 代码吗?
问问题
1165 次
1 回答
0
是的你可以。它有两种方法解析 json 响应,或者您可以使用本机 c# 代码的以下方法。有关更多详细信息,请访问 https://cloud.google.com/vision/docs/libraries#client-libraries-usage-csharp
using Google.Cloud.Vision.V1;
using System;
namespace GoogleCloudSamples
{
public class QuickStart
{
public static void Main(string[] args)
{
// Instantiates a client
var client = ImageAnnotatorClient.Create();
// Load the image file into memory
var image = Image.FromFile("wakeupcat.jpg");
// Performs label detection on the image file
var response = client.DetectLabels(image);
foreach (var annotation in response)
{
if (annotation.Description != null)
Console.WriteLine(annotation.Description);
}
}
}
}
于 2020-01-15T10:55:41.287 回答