public async Task <string> DescribeImage(DescribeImageRequestModel model) { var imageBytes = Convert.FromBase64String(model.ImageBase64); MemoryStream imageStream = new MemoryStream(imageBytes); MemoryStream outputStream = new MemoryStream(); await this.AudibleComputerVisionService.DescribeImageToStreamAsync( imageStream, outputStream, "camera"); var result = Convert.ToBase64String(outputStream.ToArray()); return(result); }
public async Task DescribeImage() { var fileBytes = await System.IO.File.ReadAllBytesAsync(this.FileData); var imageBase64 = Convert.ToBase64String(fileBytes); DescribeImageRequestModel model = new DescribeImageRequestModel() { ImageBase64 = imageBase64 }; string requestUrl = "api/AudibleComputerVision/DescribeImage"; var response = await Http.PostAsJsonAsync <DescribeImageRequestModel>(requestUrl, model); if (response.IsSuccessStatusCode) { this.AudioBase64 = await response.Content.ReadAsStringAsync(); } }