Ever wondered how AI can detect emotions from faces? π€π‘
Meet AI.Facial.Emotion β a lightweight and powerful .NET library that can analyze facial emotions, age, and gender in real-time. Whether you're building chatbots, customer analytics, security systems, or healthcare apps, this tool makes it easy to integrate AI-powered facial analysis into your projects.
π― What Can It Do?
β
Detect Emotions β Identify happiness, sadness, anger, surprise, and more.
β
Estimate Age β Predict an approximate age range.
β
Classify Gender β Recognize male or female faces.
β
Optimized for .NET β Works with .NET 6, 7, 8, and 9.
β
Multiple Input Formats β Accepts image URLs, Base64 strings, and file streams.
π Why Use It?
β
Fast & Efficient β AI models optimized for real-time processing.
β
Easy Integration β Works seamlessly with ASP.NET Web API.
β
Privacy First β No external API calls, all processing happens locally.
π¦ Installation (Super Easy!)
Just install it via NuGet:
dotnet add package AI.Facial.Emotion
Make sure your .NET Web API project is running .NET 6 or higher.
using AI.Facial.Emotion;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<EmotionAnalyzer>();
var app = builder.Build();
app.MapControllers();
app.Run();
β‘ Quick Start
1οΈβ£ Detect Emotion from an Image URL
var analyzer = new EmotionAnalyzer();
var result = await analyzer.AnalyzeEmotionFromUrlAsync("https://example.com/image.jpg");
Console.WriteLine($"Emotion: {result.Emotion}");
2οΈβ£ Detect Emotion from a Base64 Image
var base64Image = "iVBORw0KGgoAAAANSUhEUgAA...";
var result = await analyzer.AnalyzeEmotionFromBase64Async(base64Image);
Console.WriteLine($"Emotion: {result.Emotion}");
3οΈβ£ Detect Emotion from a File Stream
using var fileStream = File.OpenRead("image.jpg");
var result = await analyzer.AnalyzeEmotionFromStreamAsync(fileStream);
Console.WriteLine($"Emotion: {result.Emotion}");