Spaces:
Sleeping
Sleeping
from fastai.text.all import load_learner | |
import pathlib | |
temp = pathlib.PosixPath | |
pathlib.PosixPath = pathlib.WindowsPath | |
model_path = "models/LikeItOrNot-base-v1.pkl" | |
learner = load_learner(model_path) | |
text = "I love this movie!" | |
prediction = learner.predict(text) | |
if str(prediction[0]) == "1": | |
print("negative") | |
elif str(prediction[0]) == "2": | |
print("positive") | |
else: | |
print("dunno") | |
print("------") | |
print(prediction[0]) | |
print(type(prediction[0])) | |
print("------") | |
print(prediction) | |