如何使用JSON文件在c#中连接google cloud vision API 启用了云视觉API 从谷歌云下载了JSON文件
如何将JSON文件与c#windows应用程序连接,以及如何与从图像读取文本的Google cloud vision连接?我认为您应该使用与文档类似的内容:如何使用JSON文件在c#中连接google cloud vision API 启用了云视觉API 从谷歌云下载了JSON文件,c#,C#,如何将JSON文件与c#windows应用程序连接,以及如何与从图像读取文本的Google cloud vision连接?我认为您应该使用与文档类似的内容: using Google.Cloud.Vision.V1; using System; namespace GoogleCloudSamples { public class QuickStart { public static void Main(string[] args) {
using Google.Cloud.Vision.V1;
using System;
namespace GoogleCloudSamples
{
public class QuickStart
{
public static void Main(string[] args)
{
// jsonPath is the path to the key.json file
var credential = GoogleCredential.FromFile(jsonPath);
// Instantiates a client
var client = ImageAnnotatorClient.Create(credential);
// 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);
}
}
}
}