pierrelf commited on
Commit
ea92cff
·
1 Parent(s): f26c0df

Fix bug in login functionality

Browse files
Files changed (3) hide show
  1. .gitignore +2 -0
  2. app.py +24 -0
  3. requirements.txt +11 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ flagged
2
+ __pycache__
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ import numpy as np
4
+
5
+ transcriber = pipeline(
6
+ "automatic-speech-recognition", model="pierrelf/whisper-small-sv"
7
+ )
8
+
9
+
10
+ def transcribe(audio):
11
+ sr, y = audio
12
+ y = y.astype(np.float32)
13
+ y /= np.max(np.abs(y))
14
+
15
+ return transcriber({"sampling_rate": sr, "raw": y})["text"]
16
+
17
+
18
+ demo = gr.Interface(
19
+ transcribe,
20
+ gr.Audio(sources=["microphone"]),
21
+ "text",
22
+ )
23
+
24
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ datasets
2
+ transformers
3
+ librosa
4
+ evaluate
5
+ jiwer
6
+ gradio
7
+ python-dotenv
8
+ torch
9
+ torchvision
10
+ torchaudio
11
+ evaluate