from model import m from preprocessor import frs import pickle import time from sys import exit from tensorflow.keras.utils import pad_sequences as kps m.load_weights("model2.keras") tk = pickle.load(open('tokenizer.pickle', 'rb')) while True: t = "" try: t = frs(input("Comment: ")) except EOFError: print("\nExiting") exit(0) print(f"Processed: {t}") s = tk.texts_to_sequences([t]) print(f"Sequence: {s[0]}") ps = kps(s, maxlen = 100) p = m.predict(ps) if p >= 0.75: print(f"Result: positive ({p[0]})\n") elif p <= 0.25: print(f"Result: negative ({p[0]})\n") else: print(f"Result: unsure ({p[0]})\n")