|
@@ -43,7 +43,7 @@ namespace KdanCommon.GoogleCloud
|
|
// however, be careful not to reduce image quality in the process.
|
|
// however, be careful not to reduce image quality in the process.
|
|
// Note that the Vision API imposes a 10MB JSON request size limit;
|
|
// Note that the Vision API imposes a 10MB JSON request size limit;
|
|
// larger files should be hosted on Cloud Storage or on the web, rather than being passed as base64-encoded content in the JSON itself.
|
|
// larger files should be hosted on Cloud Storage or on the web, rather than being passed as base64-encoded content in the JSON itself.
|
|
- public async Task<ImagesResponse> GetVisionImages(List<StorageFile> images)
|
|
|
|
|
|
+ public async Task<ImagesResponse> GetVisionImages(List<StorageFile> images, string[] langHints = null)
|
|
{
|
|
{
|
|
ImagesResponse response = null;
|
|
ImagesResponse response = null;
|
|
var base64Contents = new List<string>();
|
|
var base64Contents = new List<string>();
|
|
@@ -52,7 +52,7 @@ namespace KdanCommon.GoogleCloud
|
|
var base64Content = await Base64Helper.StorageFileToBase64(image);
|
|
var base64Content = await Base64Helper.StorageFileToBase64(image);
|
|
base64Contents.Add(base64Content);
|
|
base64Contents.Add(base64Content);
|
|
}
|
|
}
|
|
- var imagesRequest = new ImgesRequest(base64Contents);
|
|
|
|
|
|
+ var imagesRequest = new ImgesRequest(base64Contents, langHints);
|
|
string requestJsonStr = JsonConvert.SerializeObject(imagesRequest);
|
|
string requestJsonStr = JsonConvert.SerializeObject(imagesRequest);
|
|
var content = new StringContent(requestJsonStr, System.Text.Encoding.UTF8, "application/json");
|
|
var content = new StringContent(requestJsonStr, System.Text.Encoding.UTF8, "application/json");
|
|
var result = await _httpClient.PostAsync(_visionImagesUri, content);
|
|
var result = await _httpClient.PostAsync(_visionImagesUri, content);
|