|
|
@ -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 |
|
|
|