How to use Whisper AI using ONNX in C#


Whisper AI is an open-source speech recognition model developed by Google that can transcribe audio files into text. ONNX (Open Neural Network Exchange) is a platform for exchanging machine learning models between different frameworks, including TensorFlow and PyTorch. In this blog post, we will explore how to use Whisper AI with ONNX in C#.


Before we begin, you should have the following installed on your computer:

* .NET Core SDK (version 3.1 or later)

* Visual Studio (version 2019 or later)

* TensorFlow 2.x

* ONNX Runtime

Steps to Use Whisper AI with ONNX in C#:

Step 1: Download the Whisper AI model

The first step is to download the Whisper AI model from the official GitHub repository (). You can download the pre-trained model or train your own model using the provided code.

Step 2: Convert the Whisper AI model to ONNX format

Once you have downloaded the Whisper AI model, you need to convert it to ONNX format. To do this, you can use the TensorFlow ONNX exporter. Open a command prompt and navigate to the directory where the Whisper AI model is located. Then run the following command:


tensorflow_onnx_exporter --input_file=path/to/whisper/model.pb --output_dir=path/to/output/directory --model_name=whisper

This will create an ONNX model in the specified output directory with the name "whisper".

Step 3: Create a C# console application

Next, you need to create a new C# console application in Visual Studio. To do this, open Visual Studio and create a new project by selecting "Console App (.NET Core)" from the list of templates. Give your project a name and click "Create".

Step 4: Add the ONNX Runtime library to your project

To use the ONNX Runtime in your C# console application, you need to add the ONNX Runtime library to your project. To do this, right-click on your project in

© 2024 - ErnesTech - Privacy
E-Commerce Return Policy