def classify_meteo_event(text, model, threshold=0.0): result = model(text, truncation=True, max_length=512)[0] label = result[0]["label"] score = result[0]["score"] if label != "none" and round(score, 2) <= threshold: label = "none" event = label return event