|
1 | 1 | # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! |
2 | 2 | import grpc |
3 | 3 |
|
4 | | -from google.cloud.vision_v1.proto import image_annotator_pb2 as google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2 |
5 | | -from google.longrunning import operations_pb2 as google_dot_longrunning_dot_operations__pb2 |
| 4 | +from google.cloud.vision_v1.proto import ( |
| 5 | + image_annotator_pb2 as google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2, |
| 6 | +) |
| 7 | +from google.longrunning import ( |
| 8 | + operations_pb2 as google_dot_longrunning_dot_operations__pb2, |
| 9 | +) |
6 | 10 |
|
7 | 11 |
|
8 | 12 | class ImageAnnotatorStub(object): |
9 | | - """Service that performs Google Cloud Vision API detection tasks over client |
| 13 | + """Service that performs Google Cloud Vision API detection tasks over client |
10 | 14 | images, such as face, landmark, logo, label, and text detection. The |
11 | 15 | ImageAnnotator service returns detected entities from the images. |
12 | 16 | """ |
13 | 17 |
|
14 | | - def __init__(self, channel): |
15 | | - """Constructor. |
| 18 | + def __init__(self, channel): |
| 19 | + """Constructor. |
16 | 20 |
|
17 | 21 | Args: |
18 | 22 | channel: A grpc.Channel. |
19 | 23 | """ |
20 | | - self.BatchAnnotateImages = channel.unary_unary( |
21 | | - '/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateImages', |
22 | | - request_serializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesRequest.SerializeToString, |
23 | | - response_deserializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesResponse.FromString, |
| 24 | + self.BatchAnnotateImages = channel.unary_unary( |
| 25 | + "/google.cloud.vision.v1.ImageAnnotator/BatchAnnotateImages", |
| 26 | + request_serializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesRequest.SerializeToString, |
| 27 | + response_deserializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesResponse.FromString, |
24 | 28 | ) |
25 | | - self.AsyncBatchAnnotateFiles = channel.unary_unary( |
26 | | - '/google.cloud.vision.v1.ImageAnnotator/AsyncBatchAnnotateFiles', |
27 | | - request_serializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.AsyncBatchAnnotateFilesRequest.SerializeToString, |
28 | | - response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, |
| 29 | + self.AsyncBatchAnnotateFiles = channel.unary_unary( |
| 30 | + "/google.cloud.vision.v1.ImageAnnotator/AsyncBatchAnnotateFiles", |
| 31 | + request_serializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.AsyncBatchAnnotateFilesRequest.SerializeToString, |
| 32 | + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, |
29 | 33 | ) |
30 | 34 |
|
31 | 35 |
|
32 | 36 | class ImageAnnotatorServicer(object): |
33 | | - """Service that performs Google Cloud Vision API detection tasks over client |
| 37 | + """Service that performs Google Cloud Vision API detection tasks over client |
34 | 38 | images, such as face, landmark, logo, label, and text detection. The |
35 | 39 | ImageAnnotator service returns detected entities from the images. |
36 | 40 | """ |
37 | 41 |
|
38 | | - def BatchAnnotateImages(self, request, context): |
39 | | - """Run image detection and annotation for a batch of images. |
| 42 | + def BatchAnnotateImages(self, request, context): |
| 43 | + """Run image detection and annotation for a batch of images. |
40 | 44 | """ |
41 | | - context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
42 | | - context.set_details('Method not implemented!') |
43 | | - raise NotImplementedError('Method not implemented!') |
| 45 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 46 | + context.set_details("Method not implemented!") |
| 47 | + raise NotImplementedError("Method not implemented!") |
44 | 48 |
|
45 | | - def AsyncBatchAnnotateFiles(self, request, context): |
46 | | - """Run asynchronous image detection and annotation for a list of generic |
| 49 | + def AsyncBatchAnnotateFiles(self, request, context): |
| 50 | + """Run asynchronous image detection and annotation for a list of generic |
47 | 51 | files, such as PDF files, which may contain multiple pages and multiple |
48 | 52 | images per page. Progress and results can be retrieved through the |
49 | 53 | `google.longrunning.Operations` interface. |
50 | 54 | `Operation.metadata` contains `OperationMetadata` (metadata). |
51 | 55 | `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results). |
52 | 56 | """ |
53 | | - context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
54 | | - context.set_details('Method not implemented!') |
55 | | - raise NotImplementedError('Method not implemented!') |
| 57 | + context.set_code(grpc.StatusCode.UNIMPLEMENTED) |
| 58 | + context.set_details("Method not implemented!") |
| 59 | + raise NotImplementedError("Method not implemented!") |
56 | 60 |
|
57 | 61 |
|
58 | 62 | def add_ImageAnnotatorServicer_to_server(servicer, server): |
59 | | - rpc_method_handlers = { |
60 | | - 'BatchAnnotateImages': grpc.unary_unary_rpc_method_handler( |
61 | | - servicer.BatchAnnotateImages, |
62 | | - request_deserializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesRequest.FromString, |
63 | | - response_serializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesResponse.SerializeToString, |
64 | | - ), |
65 | | - 'AsyncBatchAnnotateFiles': grpc.unary_unary_rpc_method_handler( |
66 | | - servicer.AsyncBatchAnnotateFiles, |
67 | | - request_deserializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.AsyncBatchAnnotateFilesRequest.FromString, |
68 | | - response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, |
69 | | - ), |
70 | | - } |
71 | | - generic_handler = grpc.method_handlers_generic_handler( |
72 | | - 'google.cloud.vision.v1.ImageAnnotator', rpc_method_handlers) |
73 | | - server.add_generic_rpc_handlers((generic_handler,)) |
| 63 | + rpc_method_handlers = { |
| 64 | + "BatchAnnotateImages": grpc.unary_unary_rpc_method_handler( |
| 65 | + servicer.BatchAnnotateImages, |
| 66 | + request_deserializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesRequest.FromString, |
| 67 | + response_serializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.BatchAnnotateImagesResponse.SerializeToString, |
| 68 | + ), |
| 69 | + "AsyncBatchAnnotateFiles": grpc.unary_unary_rpc_method_handler( |
| 70 | + servicer.AsyncBatchAnnotateFiles, |
| 71 | + request_deserializer=google_dot_cloud_dot_vision__v1_dot_proto_dot_image__annotator__pb2.AsyncBatchAnnotateFilesRequest.FromString, |
| 72 | + response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, |
| 73 | + ), |
| 74 | + } |
| 75 | + generic_handler = grpc.method_handlers_generic_handler( |
| 76 | + "google.cloud.vision.v1.ImageAnnotator", rpc_method_handlers |
| 77 | + ) |
| 78 | + server.add_generic_rpc_handlers((generic_handler,)) |
0 commit comments