File size: 1,237 Bytes
999dd31
da64ad8
f087c51
da64ad8
999dd31
 
d647f33
8893347
3bb16e1
 
d647f33
801ecb8
d647f33
da64ad8
d647f33
 
 
 
 
 
 
 
 
 
 
3bb16e1
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/kikuyu-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 Kikuyu text and choose a speaker.
"""

examples = [
    ["Nao makĩguthũkĩra indo iria maatahĩte, makĩoya ngʼondu, na ngʼombe, na tũcaũ, magĩcithĩnjĩra hau thĩ, na magĩcirĩanĩria na thakame.", "ki_1"],
    ["Hĩndĩ ĩyo Abimeleku agĩthiĩ kũrĩ Isaaka oimĩte Gerari, marĩ na Ahuzathu ũrĩa wamũtaaraga, na Fikolu mũnene wa ita ciake.", "ki_2"],
    ["Wee nĩũũĩ ũrĩa matu macio macuurĩtio wega, magegania macio ma ũrĩa ũrĩ ũmenyo mũkinyanĩru?", "ki_3"],
]

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