asr-inference / meteo_detector.py
AbirMessaoudi's picture
fase_1, fase_2 releases (#46)
1619dcb verified
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