This commit is contained in:
superobk
2024-05-16 17:05:11 +08:00
parent a586d97c12
commit 032f6cb35a
3 changed files with 15 additions and 16 deletions

View File

@ -3,16 +3,16 @@ from .sentiment import Sentiment
from .tts import TTS
from .asr import ASR
from .audio_to_text import AudioToText
from .emotion import Emotion
#from .emotion import Emotion
from .blackbox import Blackbox
from .text_to_audio import TextToAudio
from .tesou import Tesou
from .fastchat import Fastchat
from .g2e import G2E
from .text_and_image import TextAndImage
from .chroma_query import ChromaQuery
from .chroma_upsert import ChromaUpsert
from .chroma_chat import ChromaChat
# from .chroma_query import ChromaQuery
# from .chroma_upsert import ChromaUpsert
# from .chroma_chat import ChromaChat
from .melotts import MeloTTS
from .vlms import VLMS
from injector import inject, singleton
@ -28,15 +28,15 @@ class BlackboxFactory:
asr: ASR,
tts: TTS,
sentiment_engine: Sentiment,
emotion: Emotion,
#emotion: Emotion,
tesou: Tesou,
fastchat: Fastchat,
audio_chat: AudioChat,
g2e: G2E,
text_and_image: TextAndImage,
chroma_query: ChromaQuery,
chroma_upsert: ChromaUpsert,
chroma_chat: ChromaChat,
#chroma_query: ChromaQuery,
#chroma_upsert: ChromaUpsert,
#chroma_chat: ChromaChat,
melotts: MeloTTS,
vlms: VLMS) -> None:
self.models["audio_to_text"] = audio_to_text
@ -45,14 +45,14 @@ class BlackboxFactory:
self.models["tts"] = tts
self.models["sentiment_engine"] = sentiment_engine
self.models["tesou"] = tesou
self.models["emotion"] = emotion
#self.models["emotion"] = emotion
self.models["fastchat"] = fastchat
self.models["audio_chat"] = audio_chat
self.models["g2e"] = g2e
self.models["text_and_image"] = text_and_image
self.models["chroma_query"] = chroma_query
self.models["chroma_upsert"] = chroma_upsert
self.models["chroma_chat"] = chroma_chat
# self.models["chroma_query"] = chroma_query
# self.models["chroma_upsert"] = chroma_upsert
# self.models["chroma_chat"] = chroma_chat
self.models["melotts"] = melotts
self.models["vlms"] = vlms

View File

@ -57,4 +57,3 @@ class Emotion(Blackbox):
text = [{'role': 'user', 'content': text}]
sentiment = self.processing(text)
return JSONResponse(content={"sentiment": sentiment}, status_code=status.HTTP_200_OK)

View File

@ -22,8 +22,8 @@ class G2E(Blackbox):
def processing(self, model_name, prompt, template, context: list) -> str:
if context == None:
context = []
url = 'http://120.196.116.194:48890/v1'
#url = 'http://120.196.116.194:48892/v1'
#url = 'http://120.196.116.194:48890/v1'
url = 'http://120.196.116.194:48892/v1'
background_prompt = '''KOMBUKIKI是一款茶饮料目标受众 年龄20-35岁 性别:女性 地点:一线城市、二线城市 职业:精英中产、都市白领 收入水平:中高收入,有一定消费能力 兴趣和爱好:注重健康,有运动习惯
@ -65,7 +65,7 @@ class G2E(Blackbox):
api_key='YOUR_API_KEY',
base_url=url
)
model_name = client.models.list().data[0].id
model_name = client.models.list().data[1].id
print(model_name)
response = client.chat.completions.create(
model=model_name,