Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from inference import query
|
| 3 |
+
from script import *
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def interface(Language, Audio):
|
| 7 |
+
|
| 8 |
+
if Language == 'Hausa':
|
| 9 |
+
command = query(Audio, 'ha')
|
| 10 |
+
state = activate_hausa(command)
|
| 11 |
+
return state
|
| 12 |
+
|
| 13 |
+
# elif Language == 'English':
|
| 14 |
+
# command = query(Audio, lang ='en')
|
| 15 |
+
# state = activate_english(command)
|
| 16 |
+
# return state
|
| 17 |
+
|
| 18 |
+
elif Language == 'Yoruba':
|
| 19 |
+
command = query(Audio, 'ha')
|
| 20 |
+
state = activate_yoruba(command)
|
| 21 |
+
return state
|
| 22 |
+
|
| 23 |
+
else:
|
| 24 |
+
pass
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
demo = gr.Interface(
|
| 28 |
+
fn=interface,
|
| 29 |
+
inputs=[gr.Dropdown(['Hausa', 'English', 'Yoruba'], value = 'Hausa', label='Select Your Prefered Language'), gr.Audio(source ='microphone', type='filepath')],
|
| 30 |
+
outputs="text",
|
| 31 |
+
live=True
|
| 32 |
+
)
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
if __name__ == '__main__':
|
| 36 |
+
demo.launch()
|