Giter Club home page Giter Club logo

productai-csharp-sdk's Introduction

productar-csharp-sdk

安装

Nuget关键字: ProductAI,Malong

Nuget命令行 Install-Package MalongTech.ProductAI.API

快速入门

Setup your account

	 string accessKeyId = "your access key id";                        //require: 你的用户配置access_key_id
	 string secretKey =  "your secret key";                            //require: 你的用户配置secret_key 
	 ProductAIService api =
	    new ProductAIService(
	        accessKeyId,                                                 
	        secretKey                                                    
	        );        

Search image using image file path

        string imagePath;

        Dictionary<string,string> options = new Dictionary<string, string>();
        options.Add("loc","0-0-1-1");                                           //option: 图片标框的位置信息
        options.Add("count","1");

        bool isError = true;
        string respContent = "";//option: 设置总数限制

        isError =
        api.SubmitFileToSearch(
                serviceType,                                                    //require: 你的服务类型
                serviveId,                                                      //require: 你的服务ID
                imagePath,                                                      //require: 你的本地图片本地路径
                options,
                out respContent                                                 //请求返回结果获取错误数据
                );

        if (isError) {
        System.Console.WriteLine("request failed!");
        } else {
        System.Console.WriteLine("request success!");
        }

Search image async using image file path

        string imagePath ";

        Dictionary<string,string> options = new Dictionary<string, string>();
        options.Add("loc", "0-0-1-1");                                          //option: 图片标框的位置信息
        options.Add("count", "1");                                              //option: 设置总数限制

        api.SubmitFileToSearchAsync(
        serviceType,                                                            //require: 你的服务类型
        serviveId,                                                              //require: 你的服务ID
        imagePath,                                                              //require: 你的本地图片的路径
        options,
        TestCallback                                                            //你的异步回调函数
        );

Search image using image binary file

        Dictionary<string,string> options = new Dictionary<string, string>(); 
        byte[] fileBytes;                                                       
        options.Add("loc", "0-0-1-1");                                          //option: 图片标框的位置信息
        options.Add("count", "1");                                              //option: 设置总数限制

        bool isError = true;
        string respContent = "";

        isError =
        api.SubmitFileToSearch(
                serviceType,                                                    //require: 你的服务类型
                serviveId,                                                      //require: 你的服务ID
                fileBytes,                                                      //require: 你的本地图片二进制数据
                options ,
                out respContent
                );

        if (isError) {
        System.Console.WriteLine("request failed!");
        } else {
        System.Console.WriteLine("request success!");
        }
        System.Console.WriteLine(respContent);

Search image async using image binary file

        Dictionary<string,string> options = new Dictionary<string, string>();
        byte[] fileBytes;
        options.Add("loc", "0-0-1-1");                                          //option: 图片标框的位置信息
        options.Add("count", "1");                                              //option: 设置总数限制

        api.SubmitFileToSearchAsync(
        serviceType,                                                            //require: 你的服务类型
        serviveId,                                                              //require: 你的服务ID
        fileBytes,                                                              //require: 你的本地图片二进制数据
        options,
        TestCallback
        );

Search image using image url

        string imageUrl;

        Dictionary<string,string> options = new Dictionary<string, string>();
        options.Add("loc", "0-0-1-1");                                          //option:  图片标框的位置信息

        bool isError = true;
        string respContent = "";

        isError = api.SubmitFormToSearch(
        serviceType,                                                           //require: 你的服务类型
        serviveId,                                                             //require: 你的服务ID
        imageUrl,                                                              //require: 你的图片链接
        options,
        out respContent
        );

        if (isError) {
        System.Console.WriteLine("request failed!");
        } else {
        System.Console.WriteLine("request success!");
        }
        System.Console.WriteLine(respContent);

Search image async using image url

        string imageUrl;

        Dictionary<string,string> options = new Dictionary<string, string>();
        options.Add("loc", "0-0-1-1");                                          //option:  图片标框的位置信息                                                                              

        api.SubmitFormToSearchAsync(
        serviceType,                                                            //require: 你的服务类型
        serviveId,                                                              //require: 你的服务ID
        imageUrl,                                                               //require: 你的图片链接
        options,
        TestCallback                                                            //你的异步回调函数
        );

Upload images to image set using url

        string imageUrl;

        Dictionary<string,string>  options = new Dictionary<string, string>();
        options.Add("meta","My Test");                                          //option: 附加信息

        bool isError = true;
        string respContent = "";

        isError = api.AddImageToImageSet(
        imageSetId,                                                             //require: 你的数据集ID
        imageUrl,                                                               //require: 你的图片链接
        options,
        out respContent
        );

        if (isError) {
        System.Console.WriteLine("request failed!");
        } else {
        System.Console.WriteLine("request success!");
        }
        System.Console.WriteLine(respContent);

Upload images to image set async using url

        string imageUrl;

        Dictionary<string,string>  options = new Dictionary<string, string>();
        options.Add("meta", "My Test");                                          //option: 附加信息 

        api.AddImageToImageSetAsync(
        imageSetId,                                                              //require: 你的数据集ID
        imageUrl,                                                                //require: 你的图片链接
        options,
        TestCallback                                                             //你的异步回调函数
        );

Upload images to image set using a csv file

        string csvPath;

        Dictionary<string ,string> options = new Dictionary<string, string>();

        bool isError = true;
        string respContent = "";

        isError = api.AddImageByFile(
        imageSetId,                                                              //require: 你的数据集ID
        csvPath,                                                                 //require: 你的CSV文件的路径
        options,
        out respContent
        );

        if (isError) {
        System.Console.WriteLine("request failed!");
        } else {
        System.Console.WriteLine("request success!");
        }

        System.Console.WriteLine(respContent);

Upload images to image set async using a csv file

        string csvPath;
            
        Dictionary<string ,string> options = new Dictionary<string, string>();

        api.AddImageByFileAsync(
        imageSetId,                                                              //require: 你的数据集ID                                                    
        csvPath,                                                                 //require: 你的CSV文件的路径
        options,
        TestCallback                                                             //你的异步回调函数
        );

Remove images from image set using a csv file

        string csvPath;

        Dictionary<string ,string> options = new Dictionary<string, string>();

        bool isError = true;
        string respContent = "";

        isError = api.DeleteImageByFile(
        imageSetId,                                                              //require: 你的数据集ID
        csvPath,                                                                 //require: 你的CSV文件的路径
        options,
        out respContent
        );

        if (isError) {
        System.Console.WriteLine("request failed!");
        } else {
        System.Console.WriteLine("request success!");
        }
        System.Console.WriteLine(respContent);

Remove images from image set async using a csv file

        string csvPath;

        Dictionary<string ,string> options = new Dictionary<string, string>();

        api.DeleteImageByFileAsync(
        imageSetId,                                                              //require: 你的数据集ID                                                    
        csvPath,                                                                 //require: 你的CSV文件的路径
        options,
        RespCallback                                                             //你的异步回调函数
        ); 

request async callback function

	    static protected void TestCallback(bool isErr, string result) {
	            if (isErr) {
	                System.Console.WriteLine("request failed!");
	            } else {
	                System.Console.WriteLine("request success!");
	            }
	            System.Console.WriteLine(result);
	  	}  

productai-csharp-sdk's People

Contributors

chaozhengpeng avatar wanghaihan avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.