Spaces:
Runtime error
Runtime error
Download utils/predict.py from arifa-batool/spam-filter-app: direct link, hf CLI and curl.
- Browser
- Download file 342 Bytes
-
https://huggingface.co/spaces/arifa-batool/spam-filter-app/resolve/main/utils/predict.py
- Command line
-
hf download hf://spaces/arifa-batool/spam-filter-app/utils/predict.py
-
curl -L -o predict.py https://huggingface.co/spaces/arifa-batool/spam-filter-app/resolve/main/utils/predict.py
342 Bytes
| from .preprocessing import preprocess_text | |
| def predict(text: str, vectorizer, model) -> str: | |
| """Preprocess text, vectorize, and predict Spam/Ham.""" | |
| processed = preprocess_text(text) | |
| vectorized = vectorizer.transform([processed]) | |
| result = model.predict(vectorized)[0] | |
| return "Spam" if result == 1 else "Not Spam" | |