diff --git a/inference.py b/inference.py index 4121d5c..0f1b31d 100644 --- a/inference.py +++ b/inference.py @@ -1,9 +1,14 @@ -# loading json and creating model +##Inference Script +#importing modules from keras.models import model_from_json import keras import librosa import numpy as np from tensorflow.keras import optimizers +import os +import pandas as pd +import librosa +import glob json_file = open('model.json', 'r') loaded_model_json = json_file.read() json_file.close() @@ -12,14 +17,6 @@ loaded_model.load_weights("saved_models/Emotion_Voice_Detection_Model.h5") print("Loaded model from disk") data, sampling_rate = librosa.load('output10.wav') -import os -import pandas as pd -import librosa -import glob - -#plt.figure(figsize=(15, 5)) -#librosa.display.waveplot(data, sr=sampling_rate) -#livedf= pd.DataFrame(columns=['feature']) X, sample_rate = librosa.load('Input4.m4a', res_type='kaiser_fast',duration=2.5,sr=22050*2,offset=0.5) sample_rate = np.array(sample_rate) mfccs = np.mean(librosa.feature.mfcc(y=X, sr=sample_rate, n_mfcc=13),axis=0) @@ -34,6 +31,7 @@ verbose=1) livepreds1=livepreds.argmax(axis=1) liveabc = livepreds1.astype(int).flatten() +#Labels assigned as per README of main repo. if liveabc == 0: print("Female_angry") elif liveabc == 1: