Is it possible to upload an audio file (mp3, mp4) directly through code ? #216
Unanswered
yousefriven
asked this question in
Q&A
Replies: 2 comments 3 replies
-
From what I've seen, the load_audio() function need a file path so using a file is not supported at the moment. It could be possible to pipe the file to stdin if you pass "pipe:" as the input file name. Another solution would be to use the API webservice I co-authored. You can upload a file directly to the webservice without saving it to the filesystem. |
Beta Was this translation helpful? Give feedback.
0 replies
-
See comment for the updated answer. model.transcribe() accepts numpy array # content should be bytes of ffmpeg output
aud_array = np.frombuffer(content, np.int16).flatten().astype(np.float32) / 32768.0
model.transcribe(aud_array) |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I want to upload an audio file (mostly through flask fileStorage) to whisper.
How do I go on about that ?
I keep running into errors like :
when tried to upload content = request.files['file'].read() to whisper.load_audio(content)
TypeError: expected np.ndarray (got bytes)
_pickle.UnpicklingError: Failed to interpret file <_io.BytesIO object at 0x000001E896834680> as a pickle
This code only accepts the path for the file rather than the actual file.
result = model.transcribe("audio.mp3")
I am a novice programmer. 😅
This is so hard for me.
thanks.
Beta Was this translation helpful? Give feedback.
All reactions