

Removing our pre-launch review (unlocked by improving our automated monitoring).Implementing a default 30-day data retention policy for API users, with options for stricter retention depending on user needs.Data submitted through the API is no longer used for service improvements (including model training) unless the organization opts in.The model will only consider the final 224 tokens of the prompt and ignore anything earlier.Over the past six months, we’ve been collecting feedback from our API customers to understand how we can better serve them. This will make the transcript more accurate, as the model will use the relevant information from the previous audio. To preserve the context of a file that was split into segments, you can prompt the model with the transcript of the preceding segment. Preserve Context After Splitting Due to Large Input Size Most transcription tools would otherwise misspell the word 'Finxter'. To correct specific words or acronyms that the model often misrecognizes in the audio (e.g., 'Finxter'), you can include them in the prompt.įor example, the following prompt improves the transcription of the word Finxter: The transcript is about Finxter, a coding education platform. Here are some examples of how prompts can be used: Unlikely Words or Acronyms The prompting system is limited compared to OpenAI’s other language models, but it still provides some control over the generated audio. For example, if your prompt uses capitalization and punctuation, the model will also do so (or at least try). The model will try to match the style of the prompt. You can use a prompt to improve the quality of the transcripts generated by the Whisper API. Let’s move back to Python: 👇 Translations Endpoint header 'Content-Type: multipart/form-data' \ Here’s an example from the docs using curl, i.e., not Python: curl -request POST \ With OpenAI’s Whisper you can transcribe an audio or video file in a single line of Python code! import openai print(("whisper-1", open("godfather.mp3", "rb")))īy default, the response type will be JSON, with the raw text included: Using Curl in the Command Line (Alternative)Īdditional parameters can be set in the request by adding more -form lines with the relevant options.

If you’re an avid reader of the Finxter blog, you know the vital role of Python one-liners. To transcribe audio, you can use the following Python code: import openaiĪudio_file = open("/path/to/file/my_audio.mp3", "rb") OpenAI currently supports multiple input and output file formats. The transcriptions endpoint takes as input the audio file you want to transcribe and the desired output file format for the transcription of the audio.
Speech to text api open source how to#
💡 Recommended: How to Install OpenAI in Python? Transcriptions Endpoint You can learn more in our detailed Finxter tutorial: Read the paper if you’re interested in going down this rabbit hole! Installing OpenAI Libraryįirst, you need to install the openai library before you can use it in your Python code. The Whisper API supports a wide range of languages, including Afrikaans, Arabic, Armenian, Azerbaijani, Belarusian, Bosnian, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, English, Estonian, Finnish, French, Galician, German, Greek, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Italian, Japanese, Kannada, Kazakh, Korean, Latvian, Lithuanian, Macedonian, Malay, Marathi, Maori, Nepali, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Tagalog, Tamil, Thai, Turkish, Ukrainian, Urdu, Vietnamese, and Welsh.Īt the time of writing this, I found the following up-to-date performance scores of the model (lower is better): 👉 Whisper API can transcribe both video and audio file formats! 👈 Supported Languages In case you skimmed over the previous sentence, here it is again in bold: So, yes, you can transcribe both video and audio!
