mirror of
https://github.com/BoardWare-Genius/jarvis-models.git
synced 2025-12-13 16:53:24 +00:00
Update emotion.py
This commit is contained in:
@ -29,8 +29,7 @@ class Emotion(Blackbox):
|
|||||||
data = args[0]
|
data = args[0]
|
||||||
return isinstance(data, str)
|
return isinstance(data, str)
|
||||||
|
|
||||||
def processing(self, *args, **kwargs) -> int:
|
def processing(self, text: str) -> int:
|
||||||
text = args[0]
|
|
||||||
text = "Please use one word to infer the emotion of the following passage:\n" + text + "\nJust print out that signle word pls."
|
text = "Please use one word to infer the emotion of the following passage:\n" + text + "\nJust print out that signle word pls."
|
||||||
text = [{'role': 'user', 'content': text}]
|
text = [{'role': 'user', 'content': text}]
|
||||||
return self.model.stream_chat(text)
|
return self.model.stream_chat(text)
|
||||||
@ -47,4 +46,4 @@ class Emotion(Blackbox):
|
|||||||
text = [{'role': 'user', 'content': text}]
|
text = [{'role': 'user', 'content': text}]
|
||||||
sentiment = self.processing(text)
|
sentiment = self.processing(text)
|
||||||
return JSONResponse(content={"sentiment": sentiment }, status_code=status.HTTP_200_OK)
|
return JSONResponse(content={"sentiment": sentiment }, status_code=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user