Система не может найти файл, указанный шепотомPython

Программы на Python
Anonymous
Система не может найти файл, указанный шепотом

Сообщение Anonymous »

пытаюсь загрузить mp3 в модуль шепота, но выдает ошибку, сообщающую об ошибке пути к файлу, но я проверял тысячу раз, файл находится в указанном месте

Код: Выделить всё

import whisper

def transcribe_mp3(filename):
# Load the audio file
shell=True
audio = whisper.load_audio(filename)

# Transcribe the audio
result = whisper.transcribe(audio)

# Print the transcript
print("Transcript:", result["text"])

# Path to the MP3 file
mp3_filename ="D:/Downloads/payload.mp3"

# Transcribe the MP3 file
transcribe_mp3(mp3_filename)
ошибка

Код: Выделить всё

FileNotFoundError                         Traceback (most recent call last)
Cell In[164], line 18
15 mp3_filename ="D:/Downloads/payload.mp3"
17 # Transcribe the MP3 file
---> 18 transcribe_mp3(mp3_filename)

Cell In[164], line 6
3 def transcribe_mp3(filename):
4     # Load the audio file
5     shell=True
----> 6     audio = whisper.load_audio(filename)
8     # Transcribe the audio
9     result = whisper.transcribe(audio)

File c:\Users\hirth\AppData\Local\Programs\Python\Python312\Lib\site-packages\whisper\audio.py:58, in load_audio(file, sr)
56 # fmt: on
57 try:
---> 58     out = run(cmd, capture_output=True, check=True).stdout
59 except CalledProcessError as e:
60     raise RuntimeError(f"Failed to load audio: {e.stderr.decode()}") from e

File c:\Users\hirth\AppData\Local\Programs\Python\Python312\Lib\subprocess.py:548, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
545     kwargs['stdout'] = PIPE
546     kwargs['stderr'] = PIPE
...
1553     self._close_pipe_fds(p2cread, p2cwrite,
1554                          c2pread, c2pwrite,
1555                          errread, errwrite)

FileNotFoundError: [WinError 2] The system cannot find the file specified
я хочу, чтобы файл загружался в режиме шепота и хочу видеть аудио в текстовом сообщении

Подробнее здесь: https://stackoverflow.com/questions/783 ... in-whisper

Вернуться в «Python»