コード例 #1
0
        static void Main(string[] args)
        {
            String bucket = ExtFunc.Read("\nAmazon S3 Bucket-Name with a picture:");
            String photo  = ExtFunc.Read("\nPicture Filename in Bucket:");

            // CLI-Command. Example= aws rekognition detect-labels --image "S3Object={Bucket=my-pics,Name=pic1.jpg}"
            var cmdCli = "\n\naws rekognition detect-labels --image \"S3Object={Bucket=" + bucket + ",Name=" + photo + "}\"\n";


            ExtFunc.Say("Please run following command: " + cmdCli);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: softfactories/ai_labs
        static void Main(string[] args)
        {
            String text = ExtFunc.Read("Input a text to Sentiment-Analysation i.E \"That was a nice trip. The Hotel was amazing!\"");

            AmazonComprehendClient comprehendClient = new AmazonComprehendClient(
                Amazon.RegionEndpoint.USEast1);

            // Call DetectKeyPhrases API
            Console.WriteLine("Calling DetectSentiment");
            DetectSentimentRequest detectSentimentRequest = new DetectSentimentRequest()
            {
                Text         = text,
                LanguageCode = "en"
            };
            DetectSentimentResponse detectSentimentResponse = comprehendClient.DetectSentiment(detectSentimentRequest);

            Console.WriteLine(detectSentimentResponse.Sentiment);
            Console.WriteLine("Done");
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: softfactories/ai_labs
        static void Main(string[] args)
        {
            String bucket = ExtFunc.Read("\nAmazon S3 Bucket-Name with a picture:");
            String photo  = ExtFunc.Read("\nPicture Filename in Bucket:");

            AmazonRekognitionClient rekognitionClient =
                new AmazonRekognitionClient(Amazon.RegionEndpoint.USEast1);

            var analyzed_image = new Image()
            {
                S3Object = new Amazon.Rekognition.Model.S3Object()
                {
                    Name   = photo,
                    Bucket = bucket
                },
            };

            DetectLabelsRequest detectlabelsRequest = new DetectLabelsRequest()
            {
                Image         = analyzed_image,
                MaxLabels     = 10,
                MinConfidence = 75F
            };

            try
            {
                DetectLabelsResponse detectLabelsResponse = rekognitionClient.DetectLabels(detectlabelsRequest);
                Console.WriteLine("Detected labels for " + photo);

                foreach (Label label in detectLabelsResponse.Labels)
                {
                    Console.WriteLine("{0}: {1}", label.Name, label.Confidence);
                }

                var tempUrl = GetS3Url(RegionEndpoint.USEast1, photo, bucket, 1);
                System.Diagnostics.Process.Start(tempUrl);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }