
Calling Hugging Face Models from C#: Running Whisper, sentence-transformers, and Stable Diffusion with DotNetPy 0.6.0
Over the weekend I shipped 0.6.0 of DotNetPy, a small C# library that calls CPython’s C API directly to run Python inside a .NET app. This post walks through the three machine learning samples bundled with 0.6.0 — semantic search with sentence-transformers, speech recognition with Whisper, and text-to-image with Stable Diffusion Turbo — and explains how the same release was also validated on PEP 703 free-threaded CPython. Starting Point: You Only Have C#, but the Model Lives on Hugging Face Every few months the same pattern repeats. I need Whisper for subtitles, or a sentence-transformer for search, or occasionally something like Stable Diffusion — but the only tool in hand is C#. The usual workarounds all come with a decisive downside. ...