Spaces:
Runtime error
Runtime error
File size: 1,253 Bytes
0fb9949 93523d1 5c585ab 3ad86d1 dd7ac9d 5c585ab 2271f6b 5c585ab aba5e88 5c585ab |
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 |
import gradio as gr
import os
from gradio_client import Client
auth_token = os.environ.get("HUGGING_FACE_HUB_TOKEN")
# iface = gr.load(name="mutisya/speak-api", hf_token=auth_token, src="spaces")
client = Client("mutisya/speak-api",hf_token=auth_token)
langs = "Kikuyu (kik), Luo (luo), Somali (som), Meru (mer), Kamba (kam), Swahili (swh)"
lang_list = [lang.strip() for lang in langs.split(',')]
def generate_audio(text, language):
output = client.predict(text, language)
return output
iface = gr.Interface(
fn=generate_audio,
inputs=[
gr.Textbox(
label="Input Text",
value="Ningĩ Ngai agĩathana, akiuga atĩrĩ, “Thĩ nĩ ĩmere mĩmera: Mĩmera ĩrĩa ĩciaraga mbeũ, na mĩtĩ ĩrĩa ĩciaraga matunda marĩ na mbeũ thĩinĩ, kũringana na mĩthemba yayo.” Na gũgĩtuĩka o ũguo.",
),
gr.Dropdown(
lang_list,
label="Language",
value="Kikuyu (kik)",
),
],
outputs=[gr.Audio(label="Output", type="filepath") ],
title="TTS Demo",
description="Text to speech, trained on VITS model.",
#examples=TTS_EXAMPLES,
live=False
)
if __name__ == "__main__":
#iface.queue().launch(debug=True)
iface.launch() |