mutisya commited on
Commit
8ee87f4
·
verified ·
1 Parent(s): 76eb8d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -3
app.py CHANGED
@@ -1,9 +1,31 @@
1
  import gradio as gr
2
  import os
 
3
 
4
  auth_token = os.environ.get("HUGGING_FACE_HUB_TOKEN")
5
 
6
- iface = gr.load(name="mutisya/transcribe-api", hf_token=auth_token, src="spaces")
7
 
8
- if __name__ == "__main__":
9
- iface.queue(api_open=False).launch(show_api=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
  import os
3
+ from gradio_client import Client
4
 
5
  auth_token = os.environ.get("HUGGING_FACE_HUB_TOKEN")
6
 
7
+ #iface = gr.load(name="mutisya/transcribe-api", hf_token=auth_token, src="spaces")
8
 
9
+ langs = "Swahili (swa), Kikuyu (kik), Luo (luo), Somali (som), Meru (mer), Kamba (kam)"
10
+ lang_list = [lang.strip() for lang in langs.split(',')]
11
+
12
+ client = Client("DrLugha/translate-api",hf_token=auth_token)
13
+
14
+ def transcribe(audio_microphone, language):
15
+ output = client.predict(audio_microphone, language)
16
+ return output
17
+
18
+ gradio_ui = gr.Interface(
19
+ fn=transcribe,
20
+ title="Speech Recognition",
21
+ description="",
22
+ inputs=[gr.Audio(sources=["microphone","upload"], type="filepath",label="input audio"),
23
+ gr.Dropdown(
24
+ lang_list,
25
+ label="Language",
26
+ value="Kikuyu (kik)",
27
+ ),],
28
+ outputs=[gr.Textbox(label="Recognized speech")]
29
+ )
30
+
31
+ gradio_ui.launch()