Skip to content

Commit 04f5b29

Browse files
authored
Whisper example: files must be opened in binary mode
Fixed the whisper example in readme.md. Files must be opened in binary mode, otherwise it will not work
1 parent ca71170 commit 04f5b29

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ The translations API takes as input the audio file in any of the supported langu
279279
response = client.translate(
280280
parameters: {
281281
model: "whisper-1",
282-
file: File.open('path_to_file'),
282+
file: File.open('path_to_file', 'rb'),
283283
})
284284
puts response.parsed_response['text']
285285
# => "Translation of the text"
@@ -293,7 +293,7 @@ The transcriptions API takes as input the audio file you want to transcribe and
293293
response = client.transcribe(
294294
parameters: {
295295
model: "whisper-1",
296-
file: File.open('path_to_file'),
296+
file: File.open('path_to_file', 'rb'),
297297
})
298298
puts response.parsed_response['text']
299299
# => "Transcription of the text"

0 commit comments

Comments
 (0)