This code:
import sounddevice as sd
import json
import torch
import sounddevice as sd
import pyaudio
import vosk

#Setup pyaudio for vosk
pa = pyaudio.PyAudio()
input_device_info = pa.get_default_input_device_info()
input_device_index = input_device_info['index']
stream = pa.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=8000,input_device_index=input_device_index)

#Setup vosk
model_path = "/usr/local/share/vosk-models/vosk-models/small-en-us/"
model = vosk.Model(model_path)
rec = vosk.KaldiRecognizer(model, 16000)

#Setup silero

torch.set_num_threads(4)
voice_device = torch.device('cpu')
local_file = 'model.pt'
voice_model = torch.package.PackageImporter(local_file).load_pickle("tts_models", "model")
voice_model.to(voice_device)
voice_sample_rate = 48000
speaker='en_97'


def stt_to_tts(text):
    audio = voice_model.apply_tts(text=str(text),
                                speaker=speaker,
                                sample_rate=voice_sample_rate)
    rec.AcceptWaveform(audio)
    result = json.loads(rec.Result())
    print(result["text"])
    
    
stt_to_tts("Test stt to tts loop")

Gives this error:
 File "<stdin>", line 1, in <module>
  File "/home/user1/.local/lib/python3.11/site-packages/vosk/__init__.py", line 182, in AcceptWaveform
    res = _c.vosk_recognizer_accept_waveform(self._handle, data, len(data))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: initializer for ctype 'char *' must be a cdata pointer, not Tensor I want the entire output in JSON format.
user