Ejemplo n.º 1
0
        public void SensitiveRecognition()
        {
            //对象键
            try {
                string key = photoKey;

                SensitiveContentRecognitionRequest request = new SensitiveContentRecognitionRequest(bucket, key, "p**n,terrorist,politics");

                SensitiveContentRecognitionResult result = QCloudServer.Instance().cosXml.SensitiveContentRecognition(request);

                // Console.WriteLine(result.GetResultInfo());
                Assert.IsNotEmpty((result.GetResultInfo()));

                Assert.True(result.httpCode == 200);
                Assert.NotNull(result.recognitionResult);
                Assert.NotNull(result.recognitionResult.PoliticsInfo);
                Assert.Zero(result.recognitionResult.PoliticsInfo.Code);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.Score);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.Count);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.Msg);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.Label);
                Assert.NotNull(result.recognitionResult.PoliticsInfo.HitFlag);
            }
            catch (COSXML.CosException.CosClientException clientEx)
            {
                Console.WriteLine("CosClientException: " + clientEx.Message);
                Assert.Fail();
            }
            catch (COSXML.CosException.CosServerException serverEx)
            {
                Console.WriteLine("CosServerException: " + serverEx.GetInfo());
                Assert.Fail();
            }
        }
Ejemplo n.º 2
0
 /// 图片审核
 public void SensitiveContentRecognition()
 {
     string bucket = "examplebucket-1250000000"; //存储桶,格式:BucketName-APPID
     string key    = "exampleobject";            //对象键
     //.cssg-snippet-body-start:[sensitive-content-recognition]
     SensitiveContentRecognitionRequest request =
         new SensitiveContentRecognitionRequest(bucket, key, "politics");
     SensitiveContentRecognitionResult result = cosXml.SensitiveContentRecognition(request);
     //.cssg-snippet-body-end
 }
Ejemplo n.º 3
0
        public void SensitiveRecognition()
        {
            //对象键
            //对象键
            string key = photoKey;

            SensitiveContentRecognitionRequest request = new SensitiveContentRecognitionRequest(bucket, key, "politics");

            SensitiveContentRecognitionResult result = QCloudServer.Instance().cosXml.SensitiveContentRecognition(request);

            // Console.WriteLine(result.GetResultInfo());
            Assert.IsNotEmpty((result.GetResultInfo()));

            Assert.True(result.httpCode == 200);
            Assert.NotNull(result.recognitionResult);
            Assert.NotNull(result.recognitionResult.PoliticsInfo);
            Assert.Zero(result.recognitionResult.PoliticsInfo.Code);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.Score);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.Count);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.Msg);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.Label);
            Assert.NotNull(result.recognitionResult.PoliticsInfo.HitFlag);
        }