Spaces:
Runtime error
Runtime error
File size: 590 Bytes
d0a42b4 ba1b2e2 d0a42b4 ba1b2e2 d0a42b4 ba1b2e2 d0a42b4 ba1b2e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import tensorflow as tf
import librosa
import numpy as np
import soundfile as sf
# Load the trained model
model = tf.keras.models.load_model('model/clone_tts_model.h5')
# Define input text
text_input = "Hello, welcome to CloneTTS. This is an example of text-to-speech synthesis."
# Generate the speech (preprocess as needed depending on model requirements)
speech = model.predict(np.array([text_input]))
# Save the generated speech to a .wav file
sf.write('output/speech.wav', speech, 22050) # Adjust sample rate as necessary
print("Speech generated and saved as 'output/speech.wav'") |