Spaces:
Sleeping
Sleeping
File size: 652 Bytes
90784de 3b8b3c3 90784de 3b8b3c3 90784de 3b8b3c3 6f7862c 3b8b3c3 90784de 3b8b3c3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
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()
|