Spaces:
Runtime error
Runtime error
File size: 755 Bytes
f534c35 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
from openai import OpenAI
import os
import argparse
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"),
# defaults to os.environ.get("OPENAI_API_KEY")
# api_key="My API Key",
)
from docx import Document
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument(
"--audio_file_path",
type=str,
required=True,
help="Path to the audio file to transcribe",
)
parser.add_argument(
"--output_file_path",
type=str,
required=True,
help="Path to the output file",
)
return parser.parse_args()
def transcribe_audio(audio_file_path):
with open(audio_file_path, 'rb') as audio_file:
transcription = client.audio.transcriptions.create("whisper-1", audio_file)
return transcription['text']
|