import gradio as gr from transformers import pipeline # Load the text-to-speech pipeline from Hugging Face pipe = pipeline("text2speech", model="suno/bark-small") # Define the Gradio interface def text_to_speech(text): # Generate speech from the input text using the loaded pipeline speech = pipe(text)[0]["speech"] return speech # Create the Gradio interface iface = gr.Interface(fn=text_to_speech, inputs="text", outputs="audio", title="Text-to-Speech App", description="Enter text to hear the speech") # Launch the Gradio interface iface.launch()