asr-inference / meteo_detector.py
Sarah Solito
Fase_1 and Fase_2 releases, code cleaned
d6fb6a2
raw
history blame
302 Bytes
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