mutisya's picture
Update app.py
ff5a258 verified
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/transcribe-api", hf_token=auth_token, src="spaces")
langs = "Swahili (swa), Kikuyu (kik), Luo (luo), Somali (som), Meru (mer), Kamba (kam)"
lang_list = [lang.strip() for lang in langs.split(',')]
client = Client("mutisya/transcribe-api",hf_token=auth_token)
def transcribe(audio_microphone, language):
output = client.predict(audio_microphone, language)
return output
gradio_ui = gr.Interface(
fn=transcribe,
title="Speech Recognition",
description="",
inputs=[gr.Audio(sources=["microphone","upload"], type="filepath",label="input audio"),
gr.Dropdown(
lang_list,
label="Language",
value="Kikuyu (kik)",
),],
outputs=[gr.Textbox(label="Recognized speech")]
)
gradio_ui.launch( show_error=True)