Martí Umbert
commited on
Commit
·
570b380
1
Parent(s):
3f8dd66
app_dcase.py: use gr.log
Browse files- app_dcase.py +5 -3
app_dcase.py
CHANGED
|
@@ -25,6 +25,7 @@
|
|
| 25 |
import gradio as gr
|
| 26 |
from dcase24t6.nn.hub import baseline_pipeline
|
| 27 |
import librosa
|
|
|
|
| 28 |
|
| 29 |
model = baseline_pipeline()
|
| 30 |
|
|
@@ -33,11 +34,12 @@ def dcase_inference(mic=None, file=None):
|
|
| 33 |
if mic is not None:
|
| 34 |
audio = mic
|
| 35 |
sr = 48000
|
| 36 |
-
|
| 37 |
elif file is not None:
|
| 38 |
-
|
| 39 |
audio, sr = librosa.load(file, sr=None)
|
| 40 |
-
|
|
|
|
| 41 |
else:
|
| 42 |
return "You must either provide a mic recording or a file"
|
| 43 |
|
|
|
|
| 25 |
import gradio as gr
|
| 26 |
from dcase24t6.nn.hub import baseline_pipeline
|
| 27 |
import librosa
|
| 28 |
+
import torch
|
| 29 |
|
| 30 |
model = baseline_pipeline()
|
| 31 |
|
|
|
|
| 34 |
if mic is not None:
|
| 35 |
audio = mic
|
| 36 |
sr = 48000
|
| 37 |
+
gr.info(f"sr 1: {sr}")
|
| 38 |
elif file is not None:
|
| 39 |
+
gr.info(f"file 1: {file}")
|
| 40 |
audio, sr = librosa.load(file, sr=None)
|
| 41 |
+
audio = torch.from_numpy(audio)
|
| 42 |
+
gr.info(f"file 1: {sr}")
|
| 43 |
else:
|
| 44 |
return "You must either provide a mic recording or a file"
|
| 45 |
|