fix:service some bug
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import bentoml
|
||||
import joblib
|
||||
|
||||
import re
|
||||
my_image = bentoml.images.Image(python_version="3.10") \
|
||||
.python_packages("scikit-learn", "numpy")
|
||||
|
||||
@@ -20,6 +20,7 @@ class NewsClassifierService:
|
||||
def classify(self,text: str) -> dict:
|
||||
categories = ['Competition News','financial news','Medical news','sports news']
|
||||
cleaned_text = text.strip().replace("\n", "")
|
||||
cleaned_text = re.sub(r'[\x00-\x1F]', '', cleaned_text)
|
||||
token_text =self.model_vectorizer.transform([cleaned_text])
|
||||
prediction = self.model_logistic.predict(token_text)
|
||||
print(f"Prediction: {prediction}")
|
||||
|
||||
Reference in New Issue
Block a user