Pamudu13 commited on
Commit
b52ce51
·
verified ·
1 Parent(s): 84a85a6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Initialize the pipeline with the specified model
5
+ pipe = pipeline(model="Lingalingeswaran/whisper-small-sinhala")
6
+
7
+ def transcribe(audio):
8
+ # Transcribe the audio file to text
9
+ text = pipe(audio)["text"]
10
+ return text
11
+
12
+ # Create the Gradio interface
13
+
14
+ iface = gr.Interface(
15
+ fn=transcribe,
16
+ inputs=gr.Audio(sources=["microphone", "upload"], type="filepath"),
17
+ outputs="text",
18
+ title="Whisper Small Sinhala",
19
+ description="Realtime demo for Sinhala speech recognition using a fine-tuned Whisper small model.",
20
+ )
21
+
22
+ # Launch the interface
23
+ if __name__ == "__main__":
24
+ iface.launch()