You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
could you help me for a bit ? this is what i did to run the prediction.
import pandas as pd
import numpy as np
import tensorflow as tf
import tensorflow.keras as keras
text preprocessing
from nltk.tokenize import word_tokenize
import re
plots and metrics
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score, f1_score, confusion_matrix
preparing input to our model
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.utils import to_categorical
keras layers
from keras.models import Sequential
from tensorflow.keras.layers import Embedding, Conv1D, GlobalMaxPooling1D, Dense
from keras.models import load_model
could you help me for a bit ? this is what i did to run the prediction.
import pandas as pd
import numpy as np
import tensorflow as tf
import tensorflow.keras as keras
text preprocessing
from nltk.tokenize import word_tokenize
import re
plots and metrics
import matplotlib.pyplot as plt
from sklearn.metrics import accuracy_score, f1_score, confusion_matrix
preparing input to our model
from tensorflow.keras.preprocessing.text import Tokenizer
from tensorflow.keras.preprocessing.sequence import pad_sequences
from tensorflow.keras.utils import to_categorical
keras layers
from keras.models import Sequential
from tensorflow.keras.layers import Embedding, Conv1D, GlobalMaxPooling1D, Dense
from keras.models import load_model
import time
max_seq_len = 500
tokenizer = Tokenizer()
message = ['i am so sad!']
class_names = ['joy', 'fear', 'anger', 'sadness', 'neutral']
model= load_model('models/cnn_w2v.h5')
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)))
The text was updated successfully, but these errors were encountered: