Skip to content

Commit

Permalink
Update inference.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Suraj authored Dec 3, 2020
1 parent d10149e commit 7291523
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions inference.py
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -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)
Expand All @@ -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:
Expand Down

0 comments on commit 7291523

Please sign in to comment.