xulh commited on
Commit
adf9187
·
1 Parent(s): df22e8a

代码初始化

Browse files
Files changed (1) hide show
  1. inference/inference.py +5 -4
inference/inference.py CHANGED
@@ -60,7 +60,7 @@ async def chat_completion(token: str = Body(...), messages: list = Body(...)):
60
  client = InferenceClient(api_key=token)
61
  print("问题:", messages)
62
  messages.append({
63
- "role": "system",
64
  "content": "You are a multilingual chatbot capable of understanding questions in various languages and "
65
  "providing accurate responses in the appropriate language. However, all questions must be "
66
  "answered in Chinese."
@@ -88,9 +88,10 @@ async def chat_completion(token: str = Body(...), messages: list = Body(...)):
88
  print("问题:", messages)
89
  messages.append({
90
  "role": "system",
91
- "content": "You are a highly intelligent image generation text optimizer. Your role is to take the user's "
92
- "input prompt and enhance it, ensuring it is precise, vivid, and detailed, while maintaining "
93
- "its intended meaning. Always provide the enhanced version in English."
 
94
  })
95
 
96
  # 使用 chat API 请求生成模型的回答 备选模型 google/gemma-2-2b-it
 
60
  client = InferenceClient(api_key=token)
61
  print("问题:", messages)
62
  messages.append({
63
+ "role": "assistant",
64
  "content": "You are a multilingual chatbot capable of understanding questions in various languages and "
65
  "providing accurate responses in the appropriate language. However, all questions must be "
66
  "answered in Chinese."
 
88
  print("问题:", messages)
89
  messages.append({
90
  "role": "system",
91
+ "content": "You are a highly intelligent image generation text optimizer. Your role is to enhance the "
92
+ "user's input prompt, ensuring it is precise, vivid, and detailed, while maintaining its "
93
+ "original intent. Always provide the enhanced version in English. Only reply with the "
94
+ "optimized prompt."
95
  })
96
 
97
  # 使用 chat API 请求生成模型的回答 备选模型 google/gemma-2-2b-it