Spaces:
Runtime error
Runtime error
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() |