Spaces:
Runtime error
Runtime error
File size: 610 Bytes
1845fa8 4151c7e 1845fa8 4151c7e 1845fa8 4151c7e 1845fa8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
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() |