Hi @Ravi K
Welcome to Microsoft Q&A! Thanks for posting the question.
You can use the below code in python to use the Whisper model. Please note that you need to install the latest version of openai (0.28.1)
import openai
import time
import os
openai.api_type = "azure"
openai.api_base = "https://{resourcename}.openai.azure.com/"
openai.api_key = os.getenv("AOAIKey")
openai.api_version = "2023-09-01-preview"
model_name = "whisper-1"
deployment_id = "whisper"
audio_language="en"
audio_test_file = "./hello.m4a"
result = openai.Audio.transcribe(
file=open(audio_test_file, "rb"),
model=model_name,
deployment_id=deployment_id
)
print(result.text)
Please refer to the documentation for additional information.
Please let me know if you have any questions.
Thanks
Saurabh
Please 'Accept as answer' and Upvote if it helped so that it can help others in the community looking for help on similar topics.