Я не знаю в чем проблема но в консоли пишет:
Traceback (most recent call last):
File "C:\Users\potch\OneDrive\Рабочий стол\asistent\main.py", line 5, in <module>
model = Model(r"C:\Users\potch\OneDrive\Рабочий стол\asistent\libs\ru")
File "C:\Users\potch\AppData\Local\Programs\Python\Python312\Lib\site-packages\vosk\__init__.py", line 57, in __init__
raise Exception("Failed to create a model")
Exception: Failed to create a model
Вот весь код:
from vosk import Model, KaldiRecognizer
import os
import pyaudio
model = Model(r"C:\Users\potch\OneDrive\Рабочий стол\asistent\libs\ru")
rec = KaldiRecognizer(model, 8000)
p = pyaudio.PyAudio()
stream = p.open(
format=pyaudio.paInt16,
channels=1,
rate=8000,
input=True,
frames_per_buffer=8000
)
stream.start_stream()
while True:
data = stream.read(4000)
if len(data) == 0:
break
print(rec.Result() if rec.AcceptWaveform(data) else rec.PartialResult())
print(rec.FinalResult())