Spaces:
Sleeping
Sleeping
added missing import
Browse files
app.py
CHANGED
|
@@ -2,6 +2,10 @@ import gradio as gr
|
|
| 2 |
import librosa
|
| 3 |
import tensorflow as tf
|
| 4 |
from huggingface_hub import from_pretrained_keras
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
def load_audio_to_tensor(filename):
|
| 7 |
audio, sampling_rate = librosa.load(filename, sr=None, mono=True) # load audio and convert to mono
|
|
@@ -42,7 +46,7 @@ def greet(name):
|
|
| 42 |
audio_slices = audio_slices.map(preprocess_mp3)
|
| 43 |
audio_slices = audio_slices.batch(64)
|
| 44 |
|
| 45 |
-
model = from_pretrained_keras("CXDJY/snore_ai")
|
| 46 |
|
| 47 |
yhat = model.predict(audio_slices)
|
| 48 |
yhat = [1 if prediction > 0.99 else 0 for prediction in yhat]
|
|
|
|
| 2 |
import librosa
|
| 3 |
import tensorflow as tf
|
| 4 |
from huggingface_hub import from_pretrained_keras
|
| 5 |
+
from itertools import groupby
|
| 6 |
+
import numpy as np
|
| 7 |
+
|
| 8 |
+
model = from_pretrained_keras("CXDJY/snore_ai")
|
| 9 |
|
| 10 |
def load_audio_to_tensor(filename):
|
| 11 |
audio, sampling_rate = librosa.load(filename, sr=None, mono=True) # load audio and convert to mono
|
|
|
|
| 46 |
audio_slices = audio_slices.map(preprocess_mp3)
|
| 47 |
audio_slices = audio_slices.batch(64)
|
| 48 |
|
| 49 |
+
# model = from_pretrained_keras("CXDJY/snore_ai")
|
| 50 |
|
| 51 |
yhat = model.predict(audio_slices)
|
| 52 |
yhat = [1 if prediction > 0.99 else 0 for prediction in yhat]
|