The NuGet package is available at https://nuget.optimizely.com/
For AutomaticImageDescription to work, you will have to call the .AddAutomaticImageDescription()
extension method in the Startup.ConfigureServices method.
You may pass configuration to the .AddAutomaticImageDescription()
method or use appsettings.json
instead. A configuration setting specified in appsettings.json will override any configuration configured in Startup.cs.
In the Azure portal, create a new resource. Search for «Computer Vision», select pricing tier and create.
After the resource is created, locate «Keys and Endpoint» in the left pane and add them to appsettings.json
like this.
"Gulla": {
"AutomaticImageDescription": {
"ComputerVisionSubscriptionKey": "key1",
"ComputerVisionEndpoint": "https://myendpoint.cognitiveservices.azure.com/"
}
}
If you are happy with English metadata, you may skip step 3 and 4. If you want your metadata translated to other languages you will need to create a Translator resource. Search for «Translator», select pricing tier and create.
After the resource is created, locate «Keys and Endpoint» in the left pane and add the key to the appsettings.json
like this.
"Gulla": {
"AutomaticImageDescription": {
"TranslatorSubscriptionKey": "key2"
}
}
Add your location, also known as region. The default is global. This is required if using a Cognitive Services resource.
"Gulla": {
"AutomaticImageDescription": {
"TranslatorSubscriptionRegion": "YOUR_RESOURCE_LOCATION"
}
}
If you prefer appsettings.json
:
"Gulla": {
"AutomaticImageDescription": {
"ComputerVisionSubscriptionKey": "key1",
"ComputerVisionEndpoint": "https://myendpoint.cognitiveservices.azure.com/"
"TranslatorSubscriptionKey": "key2"
"TranslatorSubscriptionRegion": "YOUR_RESOURCE_LOCATION",
"ScheduledJobMaxRequestsPerMinute": 10
}
}
If you prefer startups.cs
:
.AddAutomaticImageDescription(x =>
{
x.ComputerVisionSubscriptionKey = "key1";
x.ComputerVisionEndpoint = "https://myendpoint.cognitiveservices.azure.com/";
x.TranslatorSubscriptionKey = "key2";
x.TranslatorSubscriptionRegion = "YOUR_RESOURCE_LOCATION";
x.ScheduledJobMaxRequestsPerMinute = 10;
})
Now, you are ready to generate metadata! The next step is to add some Attributes to your image model!