AI-PredictionClient

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

MANIFEST
META.json
META.yml
Makefile.PL
README
bin/Inception.pl
cpanfile
dist.ini
lib/AI/PredictionClient.pm
lib/AI/PredictionClient/CPP/PredictionGrpcCpp.pm
lib/AI/PredictionClient/CPP/Typemaps/more_typemaps_STL_String.txt
lib/AI/PredictionClient/Classes/SimpleTensor.pm
lib/AI/PredictionClient/Docs/Overview.pod
lib/AI/PredictionClient/InceptionClient.pm
lib/AI/PredictionClient/Predict.pm
lib/AI/PredictionClient/Roles/PredictRole.pm
lib/AI/PredictionClient/Roles/PredictionRole.pm
lib/AI/PredictionClient/Testing/Camel.pm
lib/AI/PredictionClient/Testing/PredictionLoopback.pm
t/00load.t
t/author-critic.t

lib/AI/PredictionClient/CPP/PredictionGrpcCpp.pm  view on Meta::CPAN

# ABSTRACT: The C++ interface to gRPC and Protocol Buffers

use Cwd;
use Alien::Google::GRPC;
use AI::PredictionClient::Alien::TensorFlowServingProtos;
use Inline
  CPP => 'DATA',
  with => ['Alien::Google::GRPC', 'AI::PredictionClient::Alien::TensorFlowServingProtos'],
  version => '0.05',
  name => 'AI::PredictionClient::CPP::PredictionGrpcCpp',
  TYPEMAPS => getcwd . '/blib/lib/AI/PredictionClient/CPP/Typemaps/more_typemaps_STL_String.txt',
  LIBS => '-ldl',
  ccflags => '-std=c++11 -pthread';

use 5.010;
use strict;
use warnings;

1;

=pod

lib/AI/PredictionClient/Classes/SimpleTensor.pm  view on Meta::CPAN


  my $decoded_aref;

  my $value_type       = $self->dtype_values->{ $self->dtype };
  my $tensor_value_ref = \$self->tensor_ds->{$value_type};

  if ($value_aref) {

    if ($self->dtype eq 'DT_STRING' && !$self->use_base64_strings) {
      @$$tensor_value_ref
        = map { encode_base64(ref($_) ? $$_ : $_, '') } @$value_aref;
    } else {
      $$tensor_value_ref = $value_aref;
      delete $self->tensor_ds->{'stringVal'}
        ;  # When not a string delete convenience placeholder.
    }

    return [];

  } else {

    if ($self->dtype eq 'DT_STRING' && !$self->use_base64_strings) {
      @$decoded_aref = map { decode_base64($_) } @$$tensor_value_ref;
      return $decoded_aref;
    } else {
      return $$tensor_value_ref;
    }

  }
}
1;

__END__

lib/AI/PredictionClient/InceptionClient.pm  view on Meta::CPAN

    my $camel_test = AI::PredictionClient::Testing::Camel->new();
    $tensor->value([ $camel_test->camel_jpeg_ref ]);
  } else {
    $tensor->value([$image]);
  }

  $self->inputs({ images => $tensor });

  if ($self->callPredict()) {

    my $predict_output_map_href = $self->outputs;
    my $inception_results_href;

    foreach my $key (keys %$predict_output_map_href) {
      $inception_results_href->{$key} = $predict_output_map_href->{$key}
        ->value;  #Because returns Tensor objects.
    }

    $self->_set_inception_results($inception_results_href);

    return 1;
  } else {
    return 0;
  }



( run in 0.360 second using v1.01-cache-2.11-cpan-49f99fa48dc )