Forums

running flair package

Hi. I'm running a flask webapp. I've successfully installed the flair package (python 3.8) I've seemingly successfully loaded the sentiment model flair_sentiment = flair.models.TextClassifier.load('en-sentiment') But when i try to classify anything ( i.e....

s = flair.data.Sentence(text)
flair_sentiment.predict(s)

it just hangs. I know that there is a time out - but i'm classifying a small amount of text so it's not that intensive. When i run this in my own jupyter notebook running locally it doesn't take long. When i try to run it in a notebook on pythonanywhere it also hangs. I'm not over any CPU limits (or wasn't) and i get no error messages other than the timeout. Any ideas on how to approach or what the problem is?

See https://help.pythonanywhere.com/pages/MachineLearningInWebsiteCode/ about machine learning code in web apps.