from bark import SAMPLE_RATE, generate_audio, preload_models from scipy.io.wavfile import write as write_wav from IPython.display import Audio # download and load all models preload_models() def speaking(input): print("####TEXT TO SPEACH####") audio_array = generate_audio(input) write_wav("DoTTS_generation.wav", SAMPLE_RATE, audio_array) return Audio(audio_array, rate=SAMPLE_RATE)