Work directly with Files instead of path of files #1620
-
Hello everyone, Is there any idea to resolve this issue ? Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Try to use librosa to load audio data from file buffer and pass that to import io
import librosa
import whisper
model = whisper.load_model("tiny")
with open("path/to/file", "rb") as file:
buf = io.BytesIO(file.read())
data, sr = librosa.load(buf)
# Resampling might be required here
if sr != 16000:
data = librosa.resample(data, orig_sr=sr, target_sr=16000)
model.transcribe(data) Or if you already have a file buffer, try to directly pass that to |
Beta Was this translation helpful? Give feedback.
Thank you @threeal for your response :
I got this error :
can only concatenate str (not "dict") to str
when calling the transcribe() method
This is the code that i wrote :
I think that the problem is in this line of code :
Many thanks in advance.