net10.0
A simple .NET library for local image captioning with automatic model downloading from HuggingFace. Supports CUDA, DirectML, and CoreML GPU acceleration.
Published
Mar 16, 2026
7mo ago
Total Downloads
26.4K
26,404
Install
dotnet add package LMSupply.Captioner --version 0.24.1
| Product | Versions |
|---|---|
| .NET |
README
LMSupply.Captioner
Local image captioning for .NET with automatic model downloading.
Features
- Zero-config: Models download automatically from HuggingFace
- GPU Acceleration: CUDA, DirectML (Windows), CoreML (macOS)
- Cross-platform: Windows, Linux, macOS
- Simple API: Just 2 lines of code to get started
Quick Start
using LMSupply.Captioner;
// Load the default captioning model
var captioner = await LocalCaptioner.LoadAsync("default");
// Generate a caption
var result = await captioner.CaptionAsync("photo.jpg");
Console.WriteLine(result.Caption);
// Output: "A cat sitting on a windowsill looking outside"
Available Models
| Model ID | Size | Description |
|---|---|---|
default |
~500MB | ViT-GPT2 - fast, general purpose |
vit-gpt2 |
~500MB | Same as default |
smolvlm |
~600MB | SmolVLM-256M - lightweight multimodal |
florence2 |
~500MB | Florence-2-base - multi-task vision |
Advanced Usage
// Custom options
var options = new CaptionerOptions
{
MaxLength = 50,
Provider = ExecutionProvider.DirectML
};
var captioner = await LocalCaptioner.LoadAsync("default", options);
var result = await captioner.CaptionAsync("image.jpg");
Console.WriteLine($"Caption: {result.Caption}");
Console.WriteLine($"Confidence: {result.Confidence:P1}");
GPU Acceleration
Install the appropriate GPU package for your hardware:
# NVIDIA GPU
dotnet add package Microsoft.ML.OnnxRuntime.Gpu
# Windows (AMD/Intel/NVIDIA)
dotnet add package Microsoft.ML.OnnxRuntime.DirectML
Changes from Previous Version
No structural changes between v0.24.0 and v0.24.1.
Adoption Assessment
Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.
Compatibility metadata lists 1 target framework; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.