Nuget package & Web Api service built with .NET8. This repo contains the source code for the Genocs.FormRecognizer project.
Genocs.FormRecognizer is a .NET library that allows to extract tag coming from images. The ML model is built using Azure Cognitive services.
NOTE: Version 5.x.x doesn't support Microsoft Face Api any more
The project requires to have an Azure subscription with
- Storage account
- Cognitive Services
- Redis Cache
The project use a cache to store the classification modelId. You have two options:
- Use in memory cache
- Use Redis cache
The system by default use the singleton object to store the classification key value pair data.
To use the library remember to setup the classification modelId calling: POST {{root_url}}/api/Settings
"AppSettings": {
"PassportModel": "{{PassportModelUrl}}"
},
"AzureStorage": {
"AccountName": "{{accountName}}",
"AccountKey": "{{AccountKey}}",
"UploadContainer": "{{UploadContainer}}",
"TrainingSetContainerUrl": "{{TrainingSetContainerUrl}}",
"ThumbnailContainer": "{{ThumbnailContainer}}",
"InspectingFileUrl": "{{InspectingFileUrl}}"
},
"ImageClassifier": {
"Endpoint": "https://westeurope.api.cognitive.microsoft.com",
"SubscriptionKey": "{{SubscriptionKey}}",
"ModelId": "{{ModelId}}"
},
"FormRecognizer": {
"Endpoint": "https://westeurope.api.cognitive.microsoft.com",
"SubscriptionKey": "{{SubscriptionKey}}"
},
"AzureVision": {
"Endpoint": "https://westeurope.cognitiveservices.azure.com",
"SubscriptionKey": "{{SubscriptionKey}}"
},
"RedisSettings": {
"ConnectionString": "{{ConnectionString}}"
},
"RabbitMQ": {
"HostName": "localhost",
"Username": "guest",
"Password": "guest",
"VirtualHost": "/"
}The system use RabbitMQ to publish events. The following events are published:
FormDataExtractionCompleted
namespace Genocs.Integration.CognitiveServices.IntegrationEvents;
/// <summary>
/// The event to raised when Form Data extraction is completed.
/// </summary>
public class FormDataExtractionCompleted
{
/// <summary>
/// The reference id. Client can use it to keep external reference.
/// </summary>
public string? ReferenceId { get; set; }
/// <summary>
/// The request id.
/// </summary>
public string? RequestId { get; set; }
/// <summary>
/// The context id.
/// </summary>
public string? ContextId { get; set; }
/// <summary>
/// The processed resource url.
/// </summary>
public string ResourceUrl { get; set; } = default!;
/// <summary>
/// The classification object.
/// </summary>
public Classification? Classification { get; set; }
/// <summary>
/// The dynamic data about the results.
/// </summary>
public List<dynamic>? ContentData { get; set; }
}# Restore packages
dotnet restore
# Build solution
dotnet build
# Run tests
dotnet test
# Pack nuget package
dotnet pack
# Run WebApi
dotnet run --project ./src/Genocs.FormRecognizer.WebApi
# Run worker
dotnet run --project ./src/Genocs.FormRecognizer.Worker
# Build docker image
docker build -f webapi.dockerfile -t genocs/formrecognizer-webapi:5.0.4 -t genocs/formrecognizer-webapi:latest .
docker build -f worker.dockerfile -t genocs/formrecognizer-worker:5.0.4 -t genocs/formrecognizer-worker:latest .
# Push image on dockerhub
docker push genocs/formrecognizer-webapi:5.0.4
docker push genocs/formrecognizer-webapi:latest
docker push genocs/formrecognizer-worker:5.0.4
docker push genocs/formrecognizer-worker:latest
# Build using docker compose
docker-compose -f docker-compose.yml build
# Run using docker compose
docker-compose -f docker-compose.yml up -dapi-workbench.rest
Use this file inside Visual Studio code with REST Client plugin
This project is licensed with the MIT license.
View Complete Changelogs.
Has this Project helped you learn something New? or Helped you at work? Here are a few ways by which you can support.
- ⭐ Leave a star!
- 🥇 Recommend this project to your colleagues.
- 🦸 Do consider endorsing me on LinkedIn for ASP.NET Core - Connect via LinkedIn
- ☕ If you want to support this project in the long run, consider buying me a coffee!
This project exists thanks to all the people who contribute. Submit your PR and join the team!
Become a financial contributor and help me sustain the project. Support the Project!

