コード例 #1
0
        private static ComputerVisionClient CreateComputerVisionClient(AzureAIOptions options)
        {
            ComputerVisionClient computerVision = new ComputerVisionClient(
                new ApiKeyServiceClientCredentials(options.SubscriptionKey),
                new System.Net.Http.DelegatingHandler[] { });

            computerVision.Endpoint = options.Endpoint;

            return(computerVision);
        }
コード例 #2
0
        public static IServiceCollection AddAzureAI(
            this IServiceCollection services,
            AzureAIOptions options)
        {
            services.AddSingleton <AzureComputerVision>();
            Func <ComputerVisionClient> factory = () => CreateComputerVisionClient(options);

            services.AddSingleton(factory);

            return(services);
        }