コード例 #1
0
ファイル: AisServiceSample.cs プロジェクト: qfwc258/ais-sdk
        private static void ImageContent(String token, String endpoint)
        {
            // The obs url of file
            String dataUrl = "";
            // The image content confidence interval,"politics" default 0.48f,"terrorism":0
            float threshold = 0.6f;

            JArray categories = new JArray();

            categories.Add("politics");
            categories.Add("terrorism");
            categories.Add("p**n");

            // post data by native file
            String data   = utils.ConvertFileToBase64("../../data/moderation-terrorism.jpg");
            String reslut = Moderation.ImageContentToken(token, data, dataUrl, threshold, categories, endpoint);

            Console.WriteLine(reslut);

            // The OBS link must match the region, and the OBS resources of different regions are not shared
            dataUrl = "https://ais-sample-data.obs.cn-north-1.myhuaweicloud.com/terrorism.jpg";

            // post data by obs url
            reslut = Moderation.ImageContentToken(token, "", dataUrl, threshold, categories, endpoint);
            Console.WriteLine(reslut);
            Console.ReadKey();
        }