Spaces:
Runtime error
Runtime error
Download models.py from UB2002/email_classification: direct link, hf CLI and curl.
- Browser
- Download file 339 Bytes
-
https://huggingface.co/spaces/UB2002/email_classification/resolve/main/models.py
- Command line
-
hf download hf://spaces/UB2002/email_classification/models.py
-
curl -L -o models.py https://huggingface.co/spaces/UB2002/email_classification/resolve/main/models.py
339 Bytes
| 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] |