Make real time prediction with Keras

17 Views Asked by At

I made a keras model to predict audio. How can I change it to predict real time from my laptop microphone? `

# Predicts one sample
def predict(filepath, model):
    sample = wav2mfcc(filepath)
    sample_reshaped = sample.reshape(1, feature_dim_1, feature_dim_2, channel)
    return get_labels()[0][
            np.argmax(model.predict(sample_reshaped))
    ]

print(predict('./data/bed/004ae714_nohash_1.wav', model=model))

Its predicting well a single audio file. Its CNN.

0

There are 0 best solutions below