tts-dheiver / app.py
DHEIVER's picture
Update app.py
3b8b3c3
raw
history blame contribute delete
652 Bytes
import gradio as gr
from transformers import pipeline
# Initialize the pipeline
pipe = pipeline("text-to-speech", model="suno/bark-small")
# Define a function to handle the text-to-speech conversion
def text_to_speech(text):
output = pipe(text)
# Assuming the output is a sound file, we return the path to the sound file
return output['path']
# Create a Gradio interface
interface = gr.Interface(
fn=text_to_speech,
inputs="text",
outputs="audio",
title="Text-to-Speech App",
description="Convert text to speech using Hugging Face's Transformers"
)
# Launch the app
if __name__ == "__main__":
interface.launch()