File size: 339 Bytes
a08e3d4
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import joblib
from typing import Tuple

# Load saved pipeline
try:
    pipeline = joblib.load('model.joblib')
except FileNotFoundError:
    raise RuntimeError("file not found error")

def classify_email(text: str) -> str:
    """
    Given masked email text, returns predicted category label.
    """
    return pipeline.predict([text])[0]