コード例 #1
0
        /*
         * Run with your own PDF or use the sample Amtrak-Financials file
         * provided in this repo.
         */
        async static Task Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Please provide the filepath of a PDF to OCR");
                Environment.Exit(0);
            }

            IndicoConfig config = new IndicoConfig(
                host: "app.indico.io"
                );
            IndicoClient client = new IndicoClient(config);

            JObject extractConfig = new JObject()
            {
                { "preset_config", "standard" }
            };

            DocumentExtraction ocrQuery = client.DocumentExtraction(extractConfig);
            Job job = await ocrQuery.Exec(args[0]);

            JObject result = await job.Result();

            string url  = (string)result.GetValue("url");
            Blob   blob = await client.RetrieveBlob(url).Exec();

            Console.WriteLine(blob.AsJSONObject());
        }
コード例 #2
0
        async static Task Main(string[] args)
        {
            IndicoConfig config = new IndicoConfig(
                host: "app.indico.io"
                );

            IndicoClient client = new IndicoClient(config);

            string query = @"
              query GetDatasets {
                datasets {
                  id
                  name
                  status
                  rowCount
                  numModelGroups
                  modelGroups {
                    id
                  }
                }
              }
            ";

            GraphQLRequest request  = client.GraphQLRequest(query, "GetDatasets");
            JObject        response = await request.Call();

            Console.WriteLine(response);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            IndicoConfig config = new IndicoConfig(host: "app.indico.io");
            IndicoClient client = new IndicoClient(config);

            getDatasets(client);
            getModelGroup(client, 4415);
        }
コード例 #4
0
        /*
         * To actually run this example, you'll need to train a sequence
         * model on the Indico IPA Platform with the labeled-swaps-200.csv
         * file contained with this repo. Be aware that training will likely
         * take a couple hours. Once training is complete, you can run the
         * example by passing in the directory of the two sample PDF files in
         * the repo (Confirmation letter and Confirmation of Interest Rate Swap).
         *
         * Before running, replace the Model Group ID (mgId) with the
         * ID for your trained model. You can find it on the model's Review page.
         */
        async static Task Main(string[] args)
        {
            // Replace this with your Model Group ID
            int mgId = 4352;

            List <string> targetFiles = GetTargetFiles(args[0]);

            if (targetFiles.Count == 0)
            {
                Console.WriteLine("No files to process");
                Environment.Exit(0);
            }

            IndicoClient client = new IndicoClient();

            JObject extractConfig = new JObject()
            {
                { "preset_config", "legacy" }
            };

            List <string>      texts    = new List <string>();
            DocumentExtraction ocrQuery = client.DocumentExtraction(extractConfig);

            foreach (string path in targetFiles)
            {
                Console.WriteLine(path);
                Job ocrJob = await ocrQuery.Exec(path);

                JObject result = await ocrJob.Result();

                string resUrl = (string)result.GetValue("url");
                Blob   blob   = await client.RetrieveBlob(resUrl).Exec();

                JObject obj = blob.AsJSONObject();
                texts.Add((string)obj.GetValue("text"));
            }

            ModelGroup mg = await client.ModelGroupQuery(mgId).Exec();

            string status = await client.ModelGroupLoad(mg).Exec();

            Console.WriteLine($"Model status = {status}");

            Job job = await client.ModelGroupPredict(mg).Data(texts).Exec();

            JArray jobResult = await job.Results();

            Console.WriteLine(jobResult);
        }
コード例 #5
0
        public static async Task Main()
        {
            var client = new IndicoClient(GetToken(), new Uri("https://app.indico.io"));

            var dataSets = await client.DataSets().ListAsync();

            var workflows = await client.Workflows().ListAsync(dataSets.First().Id);

            var submissionClient = client.Submissions();

            var submissionIds = await submissionClient.CreateAsync(workflows.Single().Id, new[] { "workflow-sample.pdf" });

            int submissionId = submissionIds.Single();
            var submission   = await submissionClient.GetAsync(submissionId);

            var jobResult = await client.GetSubmissionResultAwaiter().WaitReady(submissionId);

            Console.ReadLine();
        }
コード例 #6
0
        /*
         * Get the progress (% complete) of a training model group. This
         * is handy as some sequence models can take a very long time (hours)
         * to train. Pass your model's Model Group ID on the command line.
         * You can find the model group ID on your model's Review page.
         */
        private static async Task Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Please provide a model group id");
                Environment.Exit(0);
            }

            int mgId = Int32.Parse(args[0]);

            var config = new IndicoConfig(
                host: "app.indico.io"
                );

            var client = new IndicoClient(config);
            var mg     = await client.ModelGroupQuery(mgId).Exec();

            var trainingStatus = await client.TrainingModelWithProgressQuery(mg).Exec();

            Console.WriteLine(mg.Name);
            Console.WriteLine(trainingStatus);
        }
コード例 #7
0
        static void getDatasets(IndicoClient client)
        {
            string query = @"
                query GetDatasets {
                    datasets {
                        id
                        name
                        status
                        rowCount
                        numModelGroups
                        modelGroups {
                            id
                        }
                    }
                  }
                ";

            GraphQLRequest request  = client.GraphQLRequest(query, "GetDatasets");
            JObject        response = request.Call();

            Console.WriteLine(response);
        }
コード例 #8
0
        /*
         * To actually run this example, you need to train a classifier in
         * the Indico IPA Platform using the reviews.csv file included in
         * this repo. After the model is trained, just pass its model group
         * ID into this sample as a command line arg. You can find the model
         * group ID on your trained model's Review page.
         */
        private static async Task Main(string[] args)
        {
            int mgId = -1;

            if (args.Length != 1)
            {
                Console.WriteLine("Please provide model group and selected model IDs");
                System.Environment.Exit(0);
            }
            else
            {
                mgId = Int32.Parse(args[0]);
            }

            var config = new IndicoConfig(
                host: "app.indico.io"
                );

            var client = new IndicoClient(config);

            var mg = await client.ModelGroupQuery(mgId).Exec();

            // Load Model
            string status = await client.ModelGroupLoad(mg).Exec();

            var reviews = new List <string>()
            {
                "This was the best food of our trip. Fantastic experience!",
                "The service was rude and the food was awful. Don\'t waste your time!"
            };

            var job = await client.ModelGroupPredict(mg).Data(reviews).Exec();

            var jobResult = await job.Results();

            Console.WriteLine(jobResult);
        }
コード例 #9
0
 public SubmissionsV1ClientAdapter(IndicoClient indicoClient) => _indicoClient = indicoClient;
コード例 #10
0
 public MultipartFormUpload(IndicoClient client) => _client = client;
コード例 #11
0
 public DataSetsV1ClientAdapter(IndicoClient indicoClientLegacy) => _indicoClientLegacy = indicoClientLegacy;
コード例 #12
0
        public Application(string token, string host)
        {
            IndicoConfig config = new IndicoConfig(host: host, apiToken: token);

            Client = new IndicoClient(config);
        }
コード例 #13
0
 public V1JobsClientAdapter(IndicoClient indicoClient, JobStatusConverter jobStatusConverter)
 {
     _indicoClient       = indicoClient;
     _jobStatusConverter = jobStatusConverter;
 }
コード例 #14
0
 public V1ModelClientAdapter(IndicoClient indicoClientLegacyClient) => _clientLegacy = indicoClientLegacyClient;
コード例 #15
0
 public UploadStream(IndicoClient client) => _client = client;
コード例 #16
0
 /// <summary>
 /// ListSubmissions constructor.
 /// </summary>
 /// <param name="client">Client used to send API requests.</param>
 public ListSubmissions(IndicoClient client) => _client = client;
コード例 #17
0
 /// <summary>
 /// WorkflowSubmissionDetailed constuctor.
 /// </summary>
 /// <param name="client"></param>
 public WorkflowSubmissionDetailed(IndicoClient client) : base(client)
 {
 }
コード例 #18
0
 /// <summary>
 /// DocumentExtraction constructor
 /// <param name="client">IndicoClient client</param>
 /// </summary>
 public DocumentExtraction(IndicoClient client)
 {
     this._client = client;
 }
コード例 #19
0
 public WorkflowsV1ClientAdapter(IndicoClient indicoClientLegacy) => _indicoClientLegacy = indicoClientLegacy;
コード例 #20
0
 /// <summary>
 /// Find the % complete of a training Model Group
 /// </summary>
 /// <param name="client">Indico Client</param>
 public TrainingModelWithProgressQuery(IndicoClient client)
 {
     this._client = client;
 }
コード例 #21
0
 public ReviewsV1ClientAdapter(IndicoClient indicoClientLegacy) => _indicoClientLegacy = indicoClientLegacy;
コード例 #22
0
        static void getModelGroup(IndicoClient client, int mgId)
        {
            ModelGroup mg = client.ModelGroupQuery(mgId).Exec();

            Console.WriteLine(mg.ToString());
        }
コード例 #23
0
 public OcrV1ClientAdapter(IndicoClient indicoClientLegacy, IStorageClient storage)
 {
     _indicoClientLegacy = indicoClientLegacy;
     _storage            = storage;
 }
コード例 #24
0
 /// <summary>
 /// WorkflowSubmission constructor.
 /// </summary>
 /// <param name="client"></param>
 public WorkflowSubmission(IndicoClient client) : base(client)
 {
 }
コード例 #25
0
 /// <summary>
 /// ListWorkflows constructor.
 /// </summary>
 /// <param name="client">Client used to send API requests.</param>
 public ListWorkflows(IndicoClient client) => _client = client;
コード例 #26
0
 /// <summary>
 /// DocumentExtraction constructor
 /// <param name="client">IndicoClient client</param>
 /// </summary>
 public DocumentExtraction(IndicoClient client) => _client = client;