File size: 1,751 Bytes
003879a
 
 
 
b8afbd5
 
bb22605
 
 
003879a
b8afbd5
 
bb22605
 
 
003879a
cce04a2
b8afbd5
bb22605
 
 
 
003879a
 
 
 
 
 
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
import gradio as gr
from asr import transcribe,detect_language,transcribe_lang

demo = gr.Interface(transcribe,
                   inputs = "microphone",
                   # gr.Audio(sources=["microphone"]),
                   outputs=["text","text"],
                   examples=["./Samples/Hindi_1.mp3","./Samples/Hindi_2.mp3","./Samples/Tamil_1.mp3","./Samples/Tamil_2.mp3","./Samples/Marathi_1.mp3","./Samples/Marathi_2.mp3","./Samples/Nepal_1.mp3","./Samples/Nepal_2.mp3"]
)
demo2 = gr.Interface(detect_language,
                     inputs = "microphone",
                   # gr.Audio(sources=["microphone"]),
                   outputs=["text","text"],
                     examples=["./Samples/Hindi_1.mp3","./Samples/Hindi_2.mp3","./Samples/Tamil_1.mp3","./Samples/Tamil_2.mp3","./Samples/Marathi_1.mp3","./Samples/Marathi_2.mp3","./Samples/Nepal_1.mp3","./Samples/Nepal_2.mp3"]
)
demo3 = gr.Interface(transcribe_lang,
                     inputs = ["microphone",gr.Radio([("Hindi","hin"),("Bengali","ben"),("Odia","ory"),("Gujarati","guj"),("Telugu","tel"),("Tamil","tam"),("Marathi","mar"),("English","eng")],value="hindi")],
                   # gr.Audio(sources=["microphone"]),
                   outputs=["text","text"],
                    examples=[["./Samples/Hindi_1.mp3","hin"],["./Samples/Hindi_2.mp3","hin"],["./Samples/Tamil_1.mp3","tam"],["./Samples/Tamil_2.mp3","tam"],["./Samples/Marathi_1.mp3","mar"],["./Samples/Marathi_2.mp3","mar"],["./Samples/climate ex short.wav","eng"]]
)
                    

tabbed_interface = gr.TabbedInterface([demo,demo2,demo3],["Transcribe by auto detecting language","Detect language","Transcribe by providing language"])

with gr.Blocks() as asr:
    tabbed_interface.render()
asr.launch()