#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ClassAnnotation {
#[prost(message, repeated, tag = "1")]
pub properties: ::prost::alloc::vec::Vec<Property>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Property {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(double, tag = "2")]
pub probability: f64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Polygon {
#[prost(message, repeated, tag = "1")]
pub vertices: ::prost::alloc::vec::Vec<Vertex>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Vertex {
#[prost(int64, tag = "1")]
pub x: i64,
#[prost(int64, tag = "2")]
pub y: i64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FaceAnnotation {
#[prost(message, repeated, tag = "1")]
pub faces: ::prost::alloc::vec::Vec<Face>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Face {
#[prost(message, optional, tag = "1")]
pub bounding_box: ::core::option::Option<Polygon>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ImageCopySearchAnnotation {
#[prost(int64, tag = "1")]
pub copy_count: i64,
#[prost(message, repeated, tag = "2")]
pub top_results: ::prost::alloc::vec::Vec<CopyMatch>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CopyMatch {
#[prost(string, tag = "1")]
pub image_url: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub page_url: ::prost::alloc::string::String,
#[prost(string, tag = "3")]
pub title: ::prost::alloc::string::String,
#[prost(string, tag = "4")]
pub description: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TextAnnotation {
#[prost(message, repeated, tag = "1")]
pub pages: ::prost::alloc::vec::Vec<Page>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Page {
#[prost(int64, tag = "1")]
pub width: i64,
#[prost(int64, tag = "2")]
pub height: i64,
#[prost(message, repeated, tag = "3")]
pub blocks: ::prost::alloc::vec::Vec<Block>,
#[prost(message, repeated, tag = "4")]
pub entities: ::prost::alloc::vec::Vec<Entity>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Entity {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub text: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
#[prost(message, optional, tag = "1")]
pub bounding_box: ::core::option::Option<Polygon>,
#[prost(message, repeated, tag = "2")]
pub lines: ::prost::alloc::vec::Vec<Line>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Line {
#[prost(message, optional, tag = "1")]
pub bounding_box: ::core::option::Option<Polygon>,
#[prost(message, repeated, tag = "2")]
pub words: ::prost::alloc::vec::Vec<Word>,
#[prost(double, tag = "3")]
pub confidence: f64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Word {
#[prost(message, optional, tag = "1")]
pub bounding_box: ::core::option::Option<Polygon>,
#[prost(string, tag = "2")]
pub text: ::prost::alloc::string::String,
#[prost(double, tag = "3")]
pub confidence: f64,
#[prost(message, repeated, tag = "4")]
pub languages: ::prost::alloc::vec::Vec<word::DetectedLanguage>,
#[prost(int64, tag = "5")]
pub entity_index: i64,
}
pub mod word {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DetectedLanguage {
#[prost(string, tag = "1")]
pub language_code: ::prost::alloc::string::String,
#[prost(double, tag = "2")]
pub confidence: f64,
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchAnalyzeRequest {
#[prost(message, repeated, tag = "1")]
pub analyze_specs: ::prost::alloc::vec::Vec<AnalyzeSpec>,
#[prost(string, tag = "2")]
pub folder_id: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeSpec {
#[prost(message, repeated, tag = "3")]
pub features: ::prost::alloc::vec::Vec<Feature>,
#[prost(string, tag = "4")]
pub mime_type: ::prost::alloc::string::String,
#[prost(oneof = "analyze_spec::Source", tags = "1, 5")]
pub source: ::core::option::Option<analyze_spec::Source>,
}
pub mod analyze_spec {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Source {
#[prost(bytes, tag = "1")]
Content(::prost::alloc::vec::Vec<u8>),
#[prost(string, tag = "5")]
Signature(::prost::alloc::string::String),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Feature {
#[prost(enumeration = "feature::Type", tag = "1")]
pub r#type: i32,
#[prost(oneof = "feature::Config", tags = "2, 3")]
pub config: ::core::option::Option<feature::Config>,
}
pub mod feature {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum Type {
Unspecified = 0,
TextDetection = 1,
Classification = 2,
FaceDetection = 3,
ImageCopySearch = 4,
}
impl Type {
pub fn as_str_name(&self) -> &'static str {
match self {
Type::Unspecified => "TYPE_UNSPECIFIED",
Type::TextDetection => "TEXT_DETECTION",
Type::Classification => "CLASSIFICATION",
Type::FaceDetection => "FACE_DETECTION",
Type::ImageCopySearch => "IMAGE_COPY_SEARCH",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"TEXT_DETECTION" => Some(Self::TextDetection),
"CLASSIFICATION" => Some(Self::Classification),
"FACE_DETECTION" => Some(Self::FaceDetection),
"IMAGE_COPY_SEARCH" => Some(Self::ImageCopySearch),
_ => None,
}
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Config {
#[prost(message, tag = "2")]
ClassificationConfig(super::FeatureClassificationConfig),
#[prost(message, tag = "3")]
TextDetectionConfig(super::FeatureTextDetectionConfig),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeatureClassificationConfig {
#[prost(string, tag = "1")]
pub model: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeatureTextDetectionConfig {
#[prost(string, repeated, tag = "1")]
pub language_codes: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, tag = "2")]
pub model: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BatchAnalyzeResponse {
#[prost(message, repeated, tag = "1")]
pub results: ::prost::alloc::vec::Vec<AnalyzeResult>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AnalyzeResult {
#[prost(message, repeated, tag = "2")]
pub results: ::prost::alloc::vec::Vec<FeatureResult>,
#[prost(message, optional, tag = "1")]
pub error: ::core::option::Option<
super::super::super::super::super::google::rpc::Status,
>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FeatureResult {
#[prost(message, optional, tag = "1")]
pub error: ::core::option::Option<
super::super::super::super::super::google::rpc::Status,
>,
#[prost(oneof = "feature_result::Feature", tags = "2, 3, 4, 5")]
pub feature: ::core::option::Option<feature_result::Feature>,
}
pub mod feature_result {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Feature {
#[prost(message, tag = "2")]
TextDetection(super::TextAnnotation),
#[prost(message, tag = "3")]
Classification(super::ClassAnnotation),
#[prost(message, tag = "4")]
FaceDetection(super::FaceAnnotation),
#[prost(message, tag = "5")]
ImageCopySearch(super::ImageCopySearchAnnotation),
}
}
pub mod vision_service_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct VisionServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl VisionServiceClient<tonic::transport::Channel> {
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> VisionServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_origin(inner: T, origin: Uri) -> Self {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> VisionServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
VisionServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[must_use]
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn batch_analyze(
&mut self,
request: impl tonic::IntoRequest<super::BatchAnalyzeRequest>,
) -> std::result::Result<
tonic::Response<super::BatchAnalyzeResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/yandex.cloud.ai.vision.v1.VisionService/BatchAnalyze",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"yandex.cloud.ai.vision.v1.VisionService",
"BatchAnalyze",
),
);
self.inner.unary(req, path, codec).await
}
}
}