Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
import numpy as np
|
|
|
4 |
|
5 |
transcriber = pipeline("automatic-speech-recognition", model="Oysiyl/w2v-bert-2.0-ukrainian-colab-CV16.0")
|
6 |
|
7 |
def transcribe(audio):
|
8 |
sr, y = audio
|
|
|
|
|
9 |
y = y.astype(np.float32)
|
10 |
y /= np.max(np.abs(y))
|
11 |
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import pipeline
|
3 |
import numpy as np
|
4 |
+
import librosa
|
5 |
|
6 |
transcriber = pipeline("automatic-speech-recognition", model="Oysiyl/w2v-bert-2.0-ukrainian-colab-CV16.0")
|
7 |
|
8 |
def transcribe(audio):
|
9 |
sr, y = audio
|
10 |
+
if sr != 16000:
|
11 |
+
y = librosa.resample(y, orig_sr=sr, target_sr=16000)
|
12 |
y = y.astype(np.float32)
|
13 |
y /= np.max(np.abs(y))
|
14 |
|