Multilabel classifier on french sentences with labels "figuratif" and "concret". You can use it with flair-library:
from flair.models import TextClassifier
from flair.data import Sentence
# Load the classifier model
classifier = TextClassifier.load('paraly_camembert_large_multilabel.pt')
# Define the prediction function
def predict(input_text):
sentence = Sentence(input_text)
classifier.predict(sentence)
# Extract the label and confidence into a dictionary format
labels = {label.value: label.score for label in sentence.labels}
return labels