I am a beginner,and i am trying to run the prediction in a different script with the loaded model,but it starts training again instead of predicting. i copied the code for the LSTM in another script,and for the prediction i did the code like this :
import numpy as np
import time
import pandas as pd
import keras
import tensorflow as tf
from keras.models import load_model
from LSTM_text_train import *
predictor = load_model('biLSTM_w2v.h5')
message = ['delivery was hour late and my pizza was cold!']
I am a beginner,and i am trying to run the prediction in a different script with the loaded model,but it starts training again instead of predicting. i copied the code for the LSTM in another script,and for the prediction i did the code like this :
import numpy as np import time
import pandas as pd
import keras import tensorflow as tf from keras.models import load_model
from LSTM_text_train import *
predictor = load_model('biLSTM_w2v.h5')
message = ['delivery was hour late and my pizza was cold!']
seq = tokenizer.texts_to_sequences(message) padded = pad_sequences(seq, maxlen=max_seq_len)
start_time = time.time() pred = model.predict(padded)
print('Message: ' + str(message)) print('predicted: {} ({:.2f} seconds)'.format(class_names[np.argmax(pred)], (time.time() - start_time)))
Thanks in advance !