Example #1
0
        public async static void GetTextFromS3(IAmazonTextract textractClient, string bucketName, string keyName)
        {
            List <Block> result = null;
            DetectDocumentTextRequest detectTextRequest = new DetectDocumentTextRequest()
            {
                Document = new Document {
                    S3Object = new S3Object {
                        Bucket = bucketName,
                        Name   = keyName
                    }
                }
            };

            try
            {
                Task <DetectDocumentTextResponse> detectTask         = textractClient.DetectDocumentTextAsync(detectTextRequest);
                DetectDocumentTextResponse        detectTextResponse = await detectTask;

                result = detectTextResponse.Blocks;
                //PrintBlockDetails(result);
            }
            catch (AmazonTextractException textractException)
            {
                Console.WriteLine(textractException.Message, textractException.InnerException);
            }
        }
        public async Task <List <Block> > GetTextFromStream(IAmazonTextract textractClient, MemoryStream stream)
        {
            List <Block> result = null;
            DetectDocumentTextRequest detectTextRequest = new DetectDocumentTextRequest()
            {
                Document = new Document
                {
                    Bytes = stream
                }
            };

            try
            {
                Task <DetectDocumentTextResponse> detectTask         = textractClient.DetectDocumentTextAsync(detectTextRequest);
                DetectDocumentTextResponse        detectTextResponse = await detectTask;

                result = detectTextResponse.Blocks;
                //PrintBlockDetails(result);
            }
            catch (AmazonTextractException textractException)
            {
                Console.WriteLine(textractException.Message, textractException.InnerException);
            }
            return(result);
        }
Example #3
0
 public StagesController(DataContext context,
                         IAmazonS3 s3Client, IAmazonRekognition rekognitionClient,
                         IAmazonTextract textractClient)
 {
     _context               = context;
     this.S3Client          = s3Client;
     this.RekognitionClient = rekognitionClient;
     this.TextractClient    = textractClient;
 }
 public TestController(DataContext context, IAmazonS3 s3Client,
                       IAmazonRekognition rekognitionClient, IAmazonTextract textractClient,
                       IAmazonPolly pollyClient, IAmazonTranscribeService transcribeClient)
 {
     _context               = context;
     this.S3Client          = s3Client;
     this.RekognitionClient = rekognitionClient;
     this.TextractClient    = textractClient;
     this.PollyClient       = pollyClient;
     this.TranscribeClient  = transcribeClient;
 }
        public AwsManagers(AwsConfig config)
        {
            var options = new AWSOptions
            {
                Credentials = new BasicAWSCredentials(config.AccessKey, config.SecretKey),
                Region      = RegionEndpoint.GetBySystemName(config.Region)
            };

            s3Client       = options.CreateServiceClient <IAmazonS3>();
            sqsCLient      = options.CreateServiceClient <IAmazonSQS>();
            textractClient = options.CreateServiceClient <IAmazonTextract>();


            dbClient = new AmazonDynamoDBClient(config.AccessKey, config.SecretKey, RegionEndpoint.GetBySystemName(config.Region));

            bucketName = config.Bucket;
            queueUrl   = config.Queue;
            tableName  = config.Table;
        }
Example #6
0
 private Amazon.Textract.Model.AnalyzeIDResponse CallAWSServiceOperation(IAmazonTextract client, Amazon.Textract.Model.AnalyzeIDRequest request)
 {
     Utils.Common.WriteVerboseEndpointMessage(this, client.Config, "Amazon Textract", "AnalyzeID");
     try
     {
         #if DESKTOP
         return(client.AnalyzeID(request));
         #elif CORECLR
         return(client.AnalyzeIDAsync(request).GetAwaiter().GetResult());
         #else
                 #error "Unknown build edition"
         #endif
     }
     catch (AmazonServiceException exc)
     {
         var webException = exc.InnerException as System.Net.WebException;
         if (webException != null)
         {
             throw new Exception(Utils.Common.FormatNameResolutionFailureMessage(client.Config, webException.Message), webException);
         }
         throw;
     }
 }
        protected override void ProcessRecord()
        {
            base.ProcessRecord();

            Client = CreateClient(_CurrentCredentials, _RegionEndpoint);
        }
Example #8
0
 public TextractTextAnalysisService(IAmazonTextract textract)
 {
     this.textract = textract;
 }
 public TextractTextDetectionService(IAmazonTextract textract)
 {
     this.textract = textract;
 }
Example #10
0
 public AWSTextractService(IAmazonTextract amazonTextract)
 {
     this.amazonTextract = amazonTextract;
 }
Example #11
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _textractClient = new AmazonTextractClient();
     _roleArn        = config.ReadText("StartTextractAnalysisCompleteSnsRole");
     _topicArn       = config.ReadText("StartTextractAnalysisCompleteSns");
 }
Example #12
0
 //--- Methods ---
 public override async Task InitializeAsync(LambdaConfig config)
 {
     _textractClient = new AmazonTextractClient();
     _s3Client       = new AmazonS3Client();
     _bucketName     = AwsConverters.ConvertBucketArnToName(config.ReadText("FileBucket"));
 }
 public DocumentService(IAmazonTextract textract)
 {
     _textract = textract;
 }