diff options
author | iddqd <iddqd@yandex-team.com> | 2024-06-11 10:12:13 +0300 |
---|---|---|
committer | iddqd <iddqd@yandex-team.com> | 2024-06-11 10:22:43 +0300 |
commit | 07f57e35443ab7f09471caf2dbf1afbcced4d9f7 (patch) | |
tree | a4a7b66ead62e83fa988a2ec2ce6576311c1f4b1 /contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1 | |
parent | 6db3b8ca95e44179e48306a58656fb1f9317d9c3 (diff) | |
download | ydb-07f57e35443ab7f09471caf2dbf1afbcced4d9f7.tar.gz |
add contrib/python/yandexcloud to import
03b7d3cad2237366b55b393e18d4dc5eb222798c
Diffstat (limited to 'contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1')
-rw-r--r-- | contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1/ocr.proto | 151 | ||||
-rw-r--r-- | contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1/ocr_service.proto | 72 |
2 files changed, 223 insertions, 0 deletions
diff --git a/contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1/ocr.proto b/contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1/ocr.proto new file mode 100644 index 0000000000..8aca9c0c67 --- /dev/null +++ b/contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1/ocr.proto @@ -0,0 +1,151 @@ +syntax = "proto3"; +package yandex.cloud.ai.ocr.v1; + +option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/ai/ocr/v1;ocr"; +option java_package = "yandex.cloud.api.ai.ocr.v1"; + + +message Polygon { + // The bounding polygon vertices. + repeated Vertex vertices = 1; +} + +message Vertex { + // X coordinate in pixels. + int64 x = 1; + + // Y coordinate in pixels. + int64 y = 2; +} + +enum Angle { + ANGLE_UNSPECIFIED = 0; + ANGLE_0 = 1; + ANGLE_90 = 2; + ANGLE_180 = 3; + ANGLE_270 = 4; +} + +message TextAnnotation { + // Page width in pixels. + int64 width = 1; + + // Page height in pixels. + int64 height = 2; + + // Recognized text blocks in this page. + repeated Block blocks = 3; + + // Recognized entities. + repeated Entity entities = 4; + + repeated Table tables = 5; + + // Full text recognized from image. + string full_text = 6; + + // Angle of rotate image + Angle rotate = 7; +} + +message Entity { + // Entity name. + string name = 1; + + // Recognized entity text. + string text = 2; +} + +message Block { + // Area on the page where the text block is located. + Polygon bounding_box = 1; + + // Recognized lines in this block. + repeated Line lines = 2; + + message DetectedLanguage { + // Detected language code. + string language_code = 1; + } + // A list of detected languages + repeated DetectedLanguage languages = 3; + + // Block position from full_text string. + repeated TextSegments text_segments = 4; +} + +message Line { + // Area on the page where the line is located. + Polygon bounding_box = 1; + + // Recognized text. + string text = 2; + + // Recognized words. + repeated Word words = 3; + + // Line position from full_text string. + repeated TextSegments text_segments = 4; + + // Angle of rotate line + Angle orientation = 5; +} + +message Word { + // Area on the page where the word is located. + Polygon bounding_box = 1; + + // Recognized word value. + string text = 2; + + // ID of the recognized word in entities array. + int64 entity_index = 3; + + // Word position from full_text string. + repeated TextSegments text_segments = 4; +} + +message TextSegments { + // Start character position from full_text string. + int64 start_index = 1; + + // Text segment length. + int64 length = 2; +} + +message Table { + // Area on the page where the table is located. + Polygon bounding_box = 1; + + // Number of rows in table. + int64 row_count = 2; + + // Number of columns in table. + int64 column_count = 3; + + // Table cells. + repeated TableCell cells = 4; +} + +message TableCell { + // Area on the page where the table cell is located. + Polygon bounding_box = 1; + + // Row index. + int64 row_index = 2; + + // Column index. + int64 column_index = 3; + + // Column span. + int64 column_span = 4; + + // Row span. + int64 row_span = 5; + + // Text in cell. + string text = 6; + + // Table cell position from full_text string. + repeated TextSegments text_segments = 7; +} diff --git a/contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1/ocr_service.proto b/contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1/ocr_service.proto new file mode 100644 index 0000000000..4cb3f1ccc9 --- /dev/null +++ b/contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1/ocr_service.proto @@ -0,0 +1,72 @@ +syntax = "proto3"; + +package yandex.cloud.ai.ocr.v1; + +import "yandex/cloud/ai/ocr/v1/ocr.proto"; +import "google/api/annotations.proto"; +import "yandex/cloud/validation.proto"; +import "yandex/cloud/api/operation.proto"; +import "yandex/cloud/operation/operation.proto"; + +option go_package = "github.com/yandex-cloud/go-genproto/yandex/cloud/ai/ocr/v1;ocr"; +option java_package = "yandex.cloud.api.ai.ocr.v1"; + + +message RecognizeTextRequest { + oneof source { + // Bytes with data + bytes content = 1; + } + + // Specifications of the ([MIME type](https://en.wikipedia.org/wiki/Media_type)). Each specification contains the file to analyze and features to use for analysis. Restrictions: + //* Supported file formats: `JPEG`, `PNG`, `PDF`. + //* Maximum file size: 20 MB. + //* Image size should not exceed 20M pixels (length x width). + //* The number of pages in a PDF file should not exceed 200 (each page counts as 1 request). + string mime_type = 2; + + // List of the languages to recognize text. + // Specified in [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format (for example, `ru`). + repeated string language_codes = 3; + + // Model to use for text detection. + string model = 4 [(length) = "<=50"]; +} + +message RecognizeTextResponse { + // Recognized text blocks in this page or text from entities. + TextAnnotation text_annotation = 1; + // Page number in PDF file. + int64 page = 2; +} + +// A set of methods for the Vision OCR service. +service TextRecognitionService { + + // To send the image for text recognition. + rpc Recognize (RecognizeTextRequest) returns (stream RecognizeTextResponse) { + option (google.api.http) = { post: "/ocr/v1/recognizeText" body: "*" }; + } +} + +message GetRecognitionRequest { + // Operation ID of async recognition request. + string operation_id = 1 [(required) = true, (length) = "<=50"]; +} + +// A set of methods for managing operations for asynchronous API requests. +service TextRecognitionAsyncService { + + // To send the image for asynchronous text recognition. + rpc Recognize (RecognizeTextRequest) returns (operation.Operation) { + option (yandex.cloud.api.operation) = { + response: "google.protobuf.Empty" + }; + option (google.api.http) = { post: "/ocr/v1/recognizeTextAsync" body: "*" }; + } + + // To get recognition results. + rpc GetRecognition(GetRecognitionRequest) returns (stream RecognizeTextResponse) { + option (google.api.http) = { get: "/ocr/v1/getRecognition"}; + } +} |