Example #1
0
 private void LoadClient()
 {
     if (Client == null)
     {
         Client = new CognitiveServicesClient(new RetryPolicy(), _loggerFactory);
     }
 }
Example #2
0
        public static async Task ExecuteFunction <FunctionType, BindingType>(ICognitiveServicesClient client,
                                                                             Type hostType,
                                                                             string functionReference)
        {
            //IExtensionConfigProvider binding = null;

            //if (typeof(BindingType) == typeof(VisionAnalysisBinding))
            //{
            //    binding = new VisionAnalysisBinding();
            //}

            //if (typeof(BindingType) == typeof(VisionDescribeBinding))
            //{
            //    binding = new VisionDescribeBinding();
            //}

            //if (typeof(BindingType) == typeof(VisionHandwritingBinding))
            //{
            //    binding = new VisionHandwritingBinding();
            //}

            //if (typeof(BindingType) == typeof(VisionOcrBinding))
            //{
            //    binding = new VisionOcrBinding();
            //}

            //if (typeof(BindingType) == typeof(VisionThumbnailBinding))
            //{
            //    binding = new VisionThumbnailBinding();
            //}

            //(binding as IVisionBinding).Client = client;


            //var jobHost = NewHost<FunctionType>(binding);

            //var args = new Dictionary<string, object>();
            //await jobHost.CallAsync(functionReference, args);

            //Dummy data to use later
            //var args = new Dictionary<string, object>{
            //    //{ "fileName", testFileName  }
            //};

            //// make sure we can write the file to data lake store
            //using (var host = await StartHostAsync(hostType))
            //{
            //    await host.GetJobHost().CallAsync(functionReference, args);
            //    functionOut = null;
            //}
        }
        public static async Task ExecuteFunction <FunctionType, BindingType>(ICognitiveServicesClient client, string functionReference)
        {
            IExtensionConfigProvider binding = null;

            if (typeof(BindingType) == typeof(VisionAnalysisBinding))
            {
                binding = new VisionAnalysisBinding();
            }

            if (typeof(BindingType) == typeof(VisionDescribeBinding))
            {
                binding = new VisionDescribeBinding();
            }

            if (typeof(BindingType) == typeof(VisionHandwritingBinding))
            {
                binding = new VisionHandwritingBinding();
            }

            if (typeof(BindingType) == typeof(VisionOcrBinding))
            {
                binding = new VisionOcrBinding();
            }

            if (typeof(BindingType) == typeof(VisionThumbnailBinding))
            {
                binding = new VisionThumbnailBinding();
            }

            (binding as IVisionBinding).Client = client;

            var jobHost = NewHost <FunctionType>(binding);

            var args = new Dictionary <string, object>();
            await jobHost.CallAsync(functionReference, args);
        }
Example #4
0
 public VisionHandwritingBinding(ILoggerFactory factory, ICognitiveServicesClient client)
 {
     _loggerFactory = factory;
     this.Client    = client;
 }
Example #5
0
 public static async Task ExecuteFunction <FunctionType, BindingType>(ICognitiveServicesClient client,
                                                                      string functionReference)
 {
 }
Example #6
0
 public VisionOcrBinding(ILoggerFactory loggerFactory, ICognitiveServicesClient client)
 {
     _loggerFactory = loggerFactory;
     this.Client    = client;
 }