Spaces:
Running
on
Zero
Running
on
Zero
File size: 302 Bytes
1619dcb |
1 2 3 4 5 6 7 8 9 10 11 12 |
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 |