File size: 1,333 Bytes
999dd31
da64ad8
f087c51
da64ad8
999dd31
 
cf4d0f4
8893347
3bb16e1
 
d647f33
801ecb8
d647f33
da64ad8
d647f33
cf4d0f4
d647f33
 
 
cf4d0f4
 
 
d647f33
 
 
3bb16e1
d647f33
 
 
cf4d0f4
 
 
d647f33
cf4d0f4
d647f33
 
336b22a
d647f33
 
 
 
 
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
40
41
42
import os
import gradio as gr
from gradio_client import Client

MY_HF_TOKEN_KEY = os.environ["MY_HF_TOKEN_KEY"]

client = Client("Ghana-NLP/ewe-tts",hf_token=MY_HF_TOKEN_KEY)

def generate(text, speaker):
    output = client.predict(text, speaker)
    return  output

title = "GhanaNLP: Speech Synthesis"

description = """
<b>How to use:</b> Enter some Ewe text and choose a speaker.
"""

examples = [
    ["Gbe ma gbe fiẽ la, wowu alẽ, nyi kple nyivi siwo woha le aʋa la me eye woɖu woƒe lã kple ʋua katã nenema.", "ee_1"],
    ["Tete mese gbe gã aɖe tso fiazikpui la gbɔ le gbɔgblɔm be, “Kpɔ ɖa, Mawu ƒe nɔƒe le amegbetɔwo dome azɔ, eye wòanɔ wo gbɔ. Woanye eƒe dukɔ, Mawu ŋutɔ anɔ wo gbɔ, eye wòanye woƒe Mawu.", "ee_2"],
    ["Eƒe ɣedzeƒeliƒo ƒe afã le dzigbeme gome tso Tapua, to Kana tɔʋu la ŋu yi ɖatɔ Domeƒu la. Esia nye Efraimviwo ƒe to la ƒe anyigba le woƒe ƒomeawo nu.", "ee_3"],
]

gr.Interface(
    fn=generate,
    inputs=[
        gr.Text(label="Input Text"),
        gr.Radio(label="Speaker", choices=[
            "ee_1",
            "ee_2",
            "ee_3",
        ],
        value="ee_1"),
    ],
    outputs=[
        gr.Audio(label="Generated Speech", type="filepath"),
    ],
    title=title,
    description=description,
    examples=examples,
).launch()