Skip to content

Commit

Permalink
fix: file format detection failed for whisper
Browse files Browse the repository at this point in the history
Signed-off-by: thiswillbeyourgithub <26625900+thiswillbeyourgithub@users.noreply.github.com>
  • Loading branch information
thiswillbeyourgithub committed Nov 9, 2023
1 parent 8e4e5d4 commit 798960a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/openai/cli/_api/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def transcribe(args: CLITranscribeArgs) -> None:
with open(args.file, "rb") as file_reader:
buffer_reader = BufferReader(file_reader.read(), desc="Upload progress")

# add the file extension otherwise file format detection fails
buffer_reader.name = "audio." + args.file.split(".")[-1]

model = get_client().audio.transcriptions.create(
file=buffer_reader,
model=args.model,
Expand All @@ -82,6 +85,8 @@ def translate(args: CLITranslationArgs) -> None:
with open(args.file, "rb") as file_reader:
buffer_reader = BufferReader(file_reader.read(), desc="Upload progress")

buffer_reader.name = "audio." + args.file.split(".")[-1]

model = get_client().audio.translations.create(
file=buffer_reader,
model=args.model,
Expand Down

0 comments on commit 798960a

Please sign in to comment.