Spaces:
Sleeping
Sleeping
| import pickle | |
| from pipeline import FeatureExtraction | |
| with open('nn_model.pkl', 'rb') as file: | |
| log_model = pickle.load(file) | |
| extractor = FeatureExtraction() | |
| def predict(text: str, model = log_model): | |
| features = extractor.fit(text) | |
| data = list(features.values())[1:] # 0: is the review itself | |
| result = model.predict([data])[0] | |
| return result | |
| if __name__ == '__main__': | |
| while True: | |
| review = input("Input your review: ") | |
| if review.lower() == 'bye': break | |
| print(f"Your review is {predict(model=log_model, text=review)}!") |