fix:service some bug
This commit is contained in:
@@ -19,7 +19,8 @@ class NewsClassifierService:
|
|||||||
@bentoml.api
|
@bentoml.api
|
||||||
def classify(self,text: str) -> dict:
|
def classify(self,text: str) -> dict:
|
||||||
categories = ['Competition News','financial news','Medical news','sports news']
|
categories = ['Competition News','financial news','Medical news','sports news']
|
||||||
token_text =self.model_vectorizer.transform([text])
|
cleaned_text = text.strip().replace("\n", "")
|
||||||
|
token_text =self.model_vectorizer.transform([cleaned_text])
|
||||||
prediction = self.model_logistic.predict(token_text)
|
prediction = self.model_logistic.predict(token_text)
|
||||||
print(f"Prediction: {prediction}")
|
print(f"Prediction: {prediction}")
|
||||||
predict = categories[prediction[0]]
|
predict = categories[prediction[0]]
|
||||||
|
|||||||
Reference in New Issue
Block a user