示例#1
0
 private void LoadClient()
 {
     if (Client == null)
     {
         Client = new CognitiveServicesClient(new RetryPolicy(), _loggerFactory);
     }
 }
示例#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);
        }
示例#4
0
 public VisionHandwritingBinding(ILoggerFactory factory, ICognitiveServicesClient client)
 {
     _loggerFactory = factory;
     this.Client    = client;
 }
示例#5
0
 public static async Task ExecuteFunction <FunctionType, BindingType>(ICognitiveServicesClient client,
                                                                      string functionReference)
 {
 }
示例#6
0
 public VisionOcrBinding(ILoggerFactory loggerFactory, ICognitiveServicesClient client)
 {
     _loggerFactory = loggerFactory;
     this.Client    = client;
 }