File size: 1,262 Bytes
1c23a65
 
 
 
 
 
 
 
2625453
1c23a65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0c64c86
1c23a65
 
 
 
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
33
34
35
36
37
38
39
import tempfile

import streamlit as st

from neon_tts_plugin_coqui import CoquiTTS


LANGUAGES = list(CoquiTTS.langs.keys())
default_lang = "ar"



title = "๐Ÿธ๐Ÿ’ฌ - NeonAI Coqui AI TTS Plugin"
description = "๐Ÿธ๐Ÿ’ฌ - a deep learning toolkit for Text-to-Speech, battle-tested in research and production"
info = "more info at [Neon Coqui TTS Plugin](https://github.com/NeonGeckoCom/neon-tts-plugin-coqui), [Coqui TTS](https://github.com/coqui-ai/TTS) - this is a streamlit version of [this](https://huggingface.co/spaces/Gradio-Blocks/neon-tts-plugin-coqui)"



coquiTTS = CoquiTTS()


def tts(text: str, language: str):
    print(text, language)
    # return output
    with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as fp:
        coquiTTS.get_tts(text, fp, speaker = {"language" : language})
        return fp.name

st.title(title)
st.subheader(description)
st.markdown(info)
txt = st.text_area("Text")
if st.button('Submit'):
    with st.spinner('Wait for it...'):
        audio_file = open(tts(txt, default_lang), 'rb')
        audio_bytes = audio_file.read()
        st.balloons()
        st.success("Yay! Check out your TTS! P.S. Why not follow my GitHub, I'm @fakerybakery on GitHub!")
        st.audio(audio_bytes, format='audio/wav')