Commit
·
4a6c542
1
Parent(s):
a43fdc1
mono audio case handled
Browse files
app.py
CHANGED
@@ -6,7 +6,12 @@ import gradio as gr
|
|
6 |
|
7 |
def preprocess(signal, sr, device):
|
8 |
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
# resampling the audio signal with the training sample rate
|
12 |
if sr != 8_000:
|
@@ -50,4 +55,4 @@ article = "<p style='text-align: center'><a href='https://github.com/khalidsaifu
|
|
50 |
examples = [
|
51 |
['sample_audio.wav']
|
52 |
]
|
53 |
-
gr.Interface(pipeline, "audio", outputs, title=title, description=description, article=article, examples=examples).launch()
|
|
|
6 |
|
7 |
def preprocess(signal, sr, device):
|
8 |
|
9 |
+
# making sure channel dimension is in the 1st axis
|
10 |
+
if len(signal.shape) > 1:
|
11 |
+
signal = torch.permute(signal, (1, 0))
|
12 |
+
# Otherwise, add a channel dimension
|
13 |
+
else:
|
14 |
+
signal = signal.unsqueeze(0)
|
15 |
|
16 |
# resampling the audio signal with the training sample rate
|
17 |
if sr != 8_000:
|
|
|
55 |
examples = [
|
56 |
['sample_audio.wav']
|
57 |
]
|
58 |
+
gr.Interface(pipeline, "audio", outputs, title=title, description=description, article=article, examples=examples).launch(share=True)
|