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 = """ How to use: 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()