aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/yandex-cloud-api-protos/yandex/cloud/ai/ocr/v1/ocr_service.proto
blob: 4cb3f1ccc9bd4477c0bfa864a3489073ebb79a30 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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"};
    }
}