Spaces:
Runtime error
Runtime error
import gradio as gr | |
# Load model directly | |
from transformers import AutoProcessor, SpeechT5ForTextToSpeech | |
processor = AutoProcessor.from_pretrained("burraco135/speecht5_finetuned_voxpopuli_it") | |
model = SpeechT5ForTextToSpeech.from_pretrained("burraco135/speecht5_finetuned_voxpopuli_it") | |
def tts(text): | |
inputs = processor(text=text, return_tensors="pt") | |
vocoder = SpeechT5HifiGan.from_pretrained("microsoft/speecht5_hifigan") | |
speech = model.generate_speech(inputs["input_ids"], speaker_embeddings, vocoder=vocoder) | |
def greet(name): | |
return "Hello " + name + "!!" | |
iface = gr.Interface(fn=tts, inputs="text", outputs="audio") | |
iface.launch() |