AI-PredictionClient

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "Test::Spelling" : "0.12"
         }
      },
      "runtime" : {
         "requires" : {
            "AI::PredictionClient::Alien::TensorFlowServingProtos" : "0",
            "Alien::Google::GRPC" : "0",
            "Cwd" : "0",
            "Data::Dumper" : "0",
            "Inline" : "0",
            "JSON" : "0",
            "MIME::Base64" : "0",
            "Moo" : "0",
            "Moo::Role" : "0",
            "MooX::Options" : "0",
            "Perl6::Form" : "0",
            "perl" : "5.01",
            "strict" : "0",
            "warnings" : "0"
         }
      },

META.json  view on Meta::CPAN

   "release_status" : "stable",
   "resources" : {
      "homepage" : "https://github.com/mountaintom/AI-PredictionClient",
      "repository" : {
         "type" : "git",
         "url" : "https://github.com/mountaintom/AI-PredictionClient.git",
         "web" : "https://github.com/mountaintom/AI-PredictionClient"
      }
   },
   "version" : "0.05",
   "x_serialization_backend" : "Cpanel::JSON::XS version 3.0233"
}

META.yml  view on Meta::CPAN

    version: '0.05'
  AI::PredictionClient::Testing::PredictionLoopback:
    file: lib/AI/PredictionClient/Testing/PredictionLoopback.pm
    version: '0.05'
requires:
  AI::PredictionClient::Alien::TensorFlowServingProtos: '0'
  Alien::Google::GRPC: '0'
  Cwd: '0'
  Data::Dumper: '0'
  Inline: '0'
  JSON: '0'
  MIME::Base64: '0'
  Moo: '0'
  Moo::Role: '0'
  MooX::Options: '0'
  Perl6::Form: '0'
  perl: '5.01'
  strict: '0'
  warnings: '0'
resources:
  homepage: https://github.com/mountaintom/AI-PredictionClient

Makefile.PL  view on Meta::CPAN

  ],
  "LICENSE" => "perl",
  "MIN_PERL_VERSION" => "5.010",
  "NAME" => "AI::PredictionClient",
  "PREREQ_PM" => {
    "AI::PredictionClient::Alien::TensorFlowServingProtos" => 0,
    "Alien::Google::GRPC" => 0,
    "Cwd" => 0,
    "Data::Dumper" => 0,
    "Inline" => 0,
    "JSON" => 0,
    "MIME::Base64" => 0,
    "Moo" => 0,
    "Moo::Role" => 0,
    "MooX::Options" => 0,
    "Perl6::Form" => 0,
    "strict" => 0,
    "warnings" => 0
  },
  "TEST_REQUIRES" => {
    "Test::More" => 0

Makefile.PL  view on Meta::CPAN

    "TESTS" => "t/*.t"
  }
);

my %FallbackPrereqs = (
  "AI::PredictionClient::Alien::TensorFlowServingProtos" => 0,
  "Alien::Google::GRPC" => 0,
  "Cwd" => 0,
  "Data::Dumper" => 0,
  "Inline" => 0,
  "JSON" => 0,
  "MIME::Base64" => 0,
  "Moo" => 0,
  "Moo::Role" => 0,
  "MooX::Options" => 0,
  "Perl6::Form" => 0,
  "Test::More" => 0,
  "strict" => 0,
  "warnings" => 0
);

cpanfile  view on Meta::CPAN

requires "AI::PredictionClient::Alien::TensorFlowServingProtos" => "0";
requires "Alien::Google::GRPC" => "0";
requires "Cwd" => "0";
requires "Data::Dumper" => "0";
requires "Inline" => "0";
requires "JSON" => "0";
requires "MIME::Base64" => "0";
requires "Moo" => "0";
requires "Moo::Role" => "0";
requires "MooX::Options" => "0";
requires "Perl6::Form" => "0";
requires "perl" => "5.01";
requires "strict" => "0";
requires "warnings" => "0";

on 'test' => sub {

dist.ini  view on Meta::CPAN

[@Filter]
-bundle = @Basic
-remove = MakeMaker

[MakeMaker::Awesome]

header = die 'Unsupported OS' if $^O eq 'MSWin32';
header = use Inline::MakeMaker;

[CPANFile]
[MetaJSON]
[PkgVersion]
[AutoPrereqs]
[PodWeaver]

[ReadmeAnyFromPod]
type = pod
filename = README.pod
location = root

[Prereqs]

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

In this design I flattened the architecture out and where the native data handling of Perl is best, 
the modules use plain old Perl data structures rather than creating another layer of accessors.

The Tensor interface is used repetitively so this package includes a simplified Tensor class 
to pack and unpack data to and from the models.

In the case of most clients, the Tensor class is simply sending and receiving rank one tensors - vectors. 
In the case of higher rank tensors, the tensor data is sent and received flattened. 
The size property would be used for importing/exporting the tensors in/out of a math package.   

The design takes advantage of the native JSON serialization capabilities built into the C++ Protocol Buffers. 
Serialization allows a much simpler more robust interface to be created between the Perl environment 
and the C++ environment. 
One of the biggest advantages is for the developer who would like to quickly extend what this package does. 
You can see how the data structures are built and directly manipulate them in Perl. 
Of course, if you can be more forward looking, building the proper roles and classes and contributing them would be great. 

=head1 DEPENDENCIES

This module is dependent on gRPC. This module will use the cpan module Alien::Google::GRPC to 
either use an existing gRPC installation on your system or if not found, the Alien::Google::GRPC

lib/AI/PredictionClient/Docs/Overview.pod  view on Meta::CPAN

In this design I flattened the architecture out and where the native data handling of Perl is best, 
the modules use plain old Perl data structures rather than creating another layer of accessors.

The Tensor interface is used repetitively so this package includes a simplified Tensor class 
to pack and unpack data to and from the models.

In the case of most clients, the Tensor class is simply sending and receiving rank one tensors - vectors. 
In the case of higher rank tensors, the tensor data is sent and received flattened. 
The size property would be used for importing/exporting the tensors in/out of a math package.   

The design takes advantage of the native JSON serialization capabilities built into the C++ Protocol Buffers. 
Serialization allows a much simpler more robust interface to be created between the Perl environment 
and the C++ environment. 
One of the biggest advantages is for the developer who would like to quickly extend what this package does. 
You can see how the data structures are built and directly manipulate them in Perl. 
Of course, if you can be more forward looking, building the proper roles and classes and contributing them would be great. 

=head1 DEPENDENCIES

This module is dependent on gRPC. This module will use the cpan module Alien::Google::GRPC to 
either use an existing gRPC installation on your system or if not found, the Alien::Google::GRPC

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',

lib/AI/PredictionClient/Roles/PredictionRole.pm  view on Meta::CPAN

has status_code => (is => 'rwp',);

has status_message => (is => 'rwp',);

sub serialize_request {
  my $self = shift;

  printf("Debug - Request: %s \n", Dumper(\$self->request_ds))
    if $self->debug_verbose;

  my $json = JSON->new;

  my $request_json = $json->encode($self->request_ds);
  printf("Debug - JSON Request: %s \n", Dumper(\$request_json))
    if $self->debug_verbose;

  return $request_json;
}

sub deserialize_reply {
  my $self              = shift;
  my $serialized_return = shift;

  printf("Debug - JSON Response: %s \n", Dumper(\$serialized_return))
    if $self->debug_verbose;

  my $json = JSON->new;

  my $returned_ds = $json->decode(
    ref($serialized_return) ? $$serialized_return : $serialized_return);
  $self->_set_status($returned_ds->{'Status'});
  $self->_set_status_code($returned_ds->{'StatusCode'});

  my $message_base = $returned_ds->{'StatusMessage'};
  my $message
    = ref($message_base)
    ? decode_base64($message_base->{'base64'}->[0])



( run in 0.421 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )