Commit
•
6b8cfb9
1
Parent(s):
b9608e4
vibe
Browse files
app.py
CHANGED
@@ -2,9 +2,8 @@ import soundfile as sf
|
|
2 |
import torch
|
3 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
4 |
import gradio as gr
|
5 |
-
import sox
|
6 |
import scipy.signal as sps
|
7 |
-
|
8 |
|
9 |
def convert(inputfile, outfile):
|
10 |
sox_tfm = sox.Transformer()
|
@@ -14,7 +13,7 @@ def convert(inputfile, outfile):
|
|
14 |
sox_tfm.build(inputfile, outfile)
|
15 |
|
16 |
def read_file(wav):
|
17 |
-
sample_rate, signal =
|
18 |
signal = signal.mean(-1)
|
19 |
number_of_samples = round(len(signal) * float(16000) / sample_rate)
|
20 |
resampled_signal = sps.resample(signal, number_of_samples)
|
|
|
2 |
import torch
|
3 |
from transformers import Wav2Vec2ForCTC, Wav2Vec2Processor
|
4 |
import gradio as gr
|
|
|
5 |
import scipy.signal as sps
|
6 |
+
import sox
|
7 |
|
8 |
def convert(inputfile, outfile):
|
9 |
sox_tfm = sox.Transformer()
|
|
|
13 |
sox_tfm.build(inputfile, outfile)
|
14 |
|
15 |
def read_file(wav):
|
16 |
+
sample_rate, signal = wav
|
17 |
signal = signal.mean(-1)
|
18 |
number_of_samples = round(len(signal) * float(16000) / sample_rate)
|
19 |
resampled_signal = sps.resample(signal, number_of_samples)
|