refactor: args

This commit is contained in:
Dan Chen
2024-03-21 15:20:09 +08:00
parent 49659dcc13
commit 726b926d98
6 changed files with 22 additions and 13 deletions

View File

@ -12,10 +12,12 @@ class Sentiment(Blackbox):
def __init__(self) -> None:
self.engine = SentimentEngine('resources/sentiment_engine/models/paimon_sentiment.onnx')
def valid(self, data: any) -> bool:
def valid(self, *args, **kwargs) -> bool:
data = args[0]
return isinstance(data, str)
def processing(self, text: any) -> int:
def processing(self, *args, **kwargs) -> int:
text = args[0]
return int(self.engine.infer(text))
async def fast_api_handler(self, request) -> Response: