Spaces:
Sleeping
Sleeping
Download NoCodeTextClassifier/Inference.py from Alamgirapi/NoCodeTextClassifier: direct link, hf CLI and curl.
- Browser
- Download file 611 Bytes
-
https://huggingface.co/spaces/Alamgirapi/NoCodeTextClassifier/resolve/64da85ee4bc624e9795bf5b01d4351a1b887d7c6/NoCodeTextClassifier/Inference.py
- Command line
-
hf download hf://spaces/Alamgirapi/NoCodeTextClassifier@64da85ee4bc624e9795bf5b01d4351a1b887d7c6/NoCodeTextClassifier/Inference.py
-
curl -L -o Inference.py https://huggingface.co/spaces/Alamgirapi/NoCodeTextClassifier/resolve/64da85ee4bc624e9795bf5b01d4351a1b887d7c6/NoCodeTextClassifier/Inference.py
611 Bytes
| from NoCodeTextClassifier import preprocessing | |
| from NoCodeTextClassifier import utils | |
| def prediction(text): | |
| TextCleaner = preprocessing.TextCleaner() | |
| clean_text = TextCleaner.clean_text(text) | |
| vectorize = preprocessing.Vectorization() | |
| vectorize_text = vectorize.TfidfVectorizer(eval=True, string=clean_text) | |
| prediction = utils.prediction("DecisionTreeClassifier.pkl",vectorize_text) | |
| encoder = utils.load_artifacts("artifacts","encoder.pkl") | |
| output = encoder.inverse_transform(prediction)[0] | |
| print(f"The prediction of given text : \t{output}") | |