Browse Source

chatgpt服务使用vllm方式预测

master
majiahui@haimaqingfan.com 2 years ago
parent
commit
e39975bcf8
  1. 2
      README.md
  2. 1
      flask_predict.py
  3. 2
      yuce3.py

2
README.md

@ -8,7 +8,7 @@ bash run_api.sh
"http://192.168.31.74:12000/predict"
{
"texts": "User:你好\nAssistant:"
"texts": "你好"
}
## 返回示例
## 请求参数

1
flask_predict.py

@ -34,6 +34,7 @@ batch_size = 32
@app.route("/predict", methods=["POST"])
def handle_query():
text = request.json["texts"] # 获取用户query中的文本 例如"I love you"
text = f"User:{text}\nAssistant:"
id_ = str(uuid.uuid1()) # 为query生成唯一标识
d = {'id': id_, 'text': text} # 绑定文本和query id
redis_.rpush(db_key_query, json.dumps(d)) # 加入redis

2
yuce3.py

@ -35,7 +35,7 @@ text = "User:生成目录#\n问:为论文题目《基于跨文化意识培养
nums = 10
nums = int(nums)
url = "http://192.168.31.74:18001/predict"
url = "http://192.168.31.74:12000/predict"
input_data = []
for i in range(nums):

Loading…
Cancel
Save