AI-PredictionClient
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/AI/PredictionClient/Roles/PredictionRole.pm view on Meta::CPAN
use strict;
use warnings;
package AI::PredictionClient::Roles::PredictionRole;
$AI::PredictionClient::Roles::PredictionRole::VERSION = '0.05';
# ABSTRACT: Implements the Prediction service interface
use AI::PredictionClient::CPP::PredictionGrpcCpp;
use AI::PredictionClient::Testing::PredictionLoopback;
use JSON ();
use Data::Dumper;
use MIME::Base64 qw( encode_base64 decode_base64 );
use Moo::Role;
has host => (is => 'ro');
has port => (is => 'ro',);
has loopback => (
is => 'rw',
default => 0,
);
has debug_verbose => (
is => 'rw',
default => 0,
);
has perception_client_object => (
is => 'lazy',
builder => 1,
);
sub _build_perception_client_object {
my $self = $_[0];
my $server_port = $self->host . ':' . $self->port;
return $self->loopback
? AI::PredictionClient::Testing::PredictionLoopback->new($server_port)
: AI::PredictionClient::CPP::PredictionGrpcCpp::PredictionClient->new(
$server_port);
}
has request_ds => (
is => 'ro',
default => sub { { modelSpec => { name => "", signatureName => "" } } },
);
has reply_ds => (
is => 'rwp',
default => sub { {} },
);
sub model_name {
my ($self, $model_name) = @_;
$self->request_ds->{"modelSpec"}->{"name"} = $model_name;
return;
}
sub model_signature {
my ($self, $model_signature) = @_;
$self->request_ds->{"modelSpec"}->{"signatureName"} = $model_signature;
return;
}
has status => (is => 'rwp',);
has status_code => (is => 'rwp',);
has status_message => (is => 'rwp',);
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.547 second using v1.00-cache-2.02-grep-82fe00e-cpan-2c419f77a38b )