Spaces:
Sleeping
Sleeping
File size: 839 Bytes
6a81069 |
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 26 27 28 29 30 31 32 |
# Install the necessary libraries
# !pip install gtts gradio
from gtts import gTTS
import gradio as gr
# Function to convert text to audio
def text_to_audio(mytext):
# Create a gTTS object with Bulgarian language
tts = gTTS(text=mytext, lang='bg')
# Save the audio file
filename = "output.mp3"
tts.save(filename)
return filename
# Gradio interface
def gradio_interface(text):
audio_file = text_to_audio(text)
return audio_file
# Create a Gradio interface
iface = gr.Interface(
fn=gradio_interface,
inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
outputs=gr.Audio(type="filepath"),
title="Text to Speech Application (Bulgarian audio)",
description="Type your text and to generate the corresponding audio in Bulgarian."
)
# Launch the interface
iface.launch(share=True)
|