Search in sources :

Example 6 with GoogleStorageLocation

use of com.google.cloud.spring.storage.GoogleStorageLocation in project spring-cloud-gcp by GoogleCloudPlatform.

the class DocumentOcrTemplateIntegrationTests method testParseOcrResultSet.

@Test
void testParseOcrResultSet() throws InvalidProtocolBufferException {
    GoogleStorageLocation ocrOutputPrefix = GoogleStorageLocation.forFolder("vision-integration-test-bucket", "json_output_set/");
    DocumentOcrResultSet result = this.documentOcrTemplate.readOcrOutputFileSet(ocrOutputPrefix);
    String text = result.getPage(2).getText();
    assertThat(text).contains("Hello World. Is mayonnaise an instrument?");
}
Also used : DocumentOcrResultSet(com.google.cloud.spring.vision.DocumentOcrResultSet) GoogleStorageLocation(com.google.cloud.spring.storage.GoogleStorageLocation) Test(org.junit.jupiter.api.Test)

Aggregations

GoogleStorageLocation (com.google.cloud.spring.storage.GoogleStorageLocation)6 DocumentOcrResultSet (com.google.cloud.spring.vision.DocumentOcrResultSet)4 Test (org.junit.jupiter.api.Test)4 WriteChannel (com.google.cloud.WriteChannel)1 BlobId (com.google.cloud.storage.BlobId)1 BlobInfo (com.google.cloud.storage.BlobInfo)1 AsyncBatchAnnotateFilesResponse (com.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse)1 TextAnnotation (com.google.cloud.vision.v1.TextAnnotation)1 ArrayList (java.util.ArrayList)1 Resource (org.springframework.core.io.Resource)1 SettableListenableFuture (org.springframework.util.concurrent.SettableListenableFuture)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1 ModelAndView (org.springframework.web.servlet.ModelAndView)1