import numpy as np
import sys
+
+import scipy.io.wavfile as wav
+import numpy as np
+from python_speech_featuresimport mfcc
+
from keras.models import model_from_json
-with open('model.json', 'r') as f:
- json = f.read()
+modelfile = sys.argv[1]
+hdf5file = '{}.hdf5'.format(modelfile[-4:])
+with open(modelfile, 'r') as f:
+ json = f.read()
model = model_from_json(json)
-model.load_weights('./model.hdf5')
+model.load_weights(hdf5file)
+
model.compile(
loss='binary_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])
-dat = np.genfromtxt(sys.stdin.buffer, dtype=float, delimiter='\t')
+(rate, sig) = wav.read(sys.stdin.buffer)
+data = mfcc(sig, rate, winlen
for i in model.predict(dat, batch_size=32, verbose=0):
print(i[0])