Spaces:
Runtime error
Runtime error
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'") |