GetmanY1 commited on
Commit
7e6e084
·
1 Parent(s): 78d03a3

Add application file

Browse files
Files changed (2) hide show
  1. app.py +28 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ from librosa import load
4
+
5
+ def transcribe(input_audio):
6
+ speech, _ = load(input_audio, sr=16000, mono=True)
7
+ output = pipe(speech, chunk_length_s=30, stride_length_s=5)['text']
8
+ return output
9
+
10
+ pipe = pipeline(
11
+ "automatic-speech-recognition",
12
+ model="GetmanY1/wav2vec2-large-sami-cont-pt-22k-finetuned",
13
+ device="cpu"
14
+ )
15
+
16
+ gradio_app = gr.Interface(
17
+ transcribe,
18
+ gr.Audio(sources=["upload","microphone"]),
19
+ "text",
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ gradio_app.launch()
24
+
25
+
26
+
27
+ # if __name__ == "__main__":
28
+ # gradio_app.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ transformers
2
+ torch
3
+ librosa