Created
January 28, 2024 20:20
-
-
Save jeanmidevacc/2f2968ae4ca0259d7f181bcaada7f226 to your computer and use it in GitHub Desktop.
openai_whisper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pathlib import Path | |
from openai import OpenAI | |
client_openai = OpenAI( | |
# This is the default and can be omitted | |
api_key="sk-XXX", | |
) | |
def get_transcript_openai_api(file, language="fr"): | |
# f = open(file, "rb") | |
transcript = client_openai.audio.transcriptions.create( | |
model="whisper-1", | |
language=language, | |
temperature=0, | |
file=Path(file) | |
) | |
return transcript.text | |
transcript = get_transcript_openai_api(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment