Support conversation via API.
This commit is contained in:
parent
e821682430
commit
748b804bac
26
src/api.py
26
src/api.py
|
@ -2,20 +2,24 @@
|
||||||
# Chat with LLaMA in API mode.
|
# Chat with LLaMA in API mode.
|
||||||
# Usage: python cli_demo.py --model_name_or_path path_to_model --checkpoint_dir path_to_checkpoint
|
# Usage: python cli_demo.py --model_name_or_path path_to_model --checkpoint_dir path_to_checkpoint
|
||||||
|
|
||||||
# Call: curl --location 'http://127.0.0.1:8000' --header 'Content-Type: application/json' --data '{
|
# Call:
|
||||||
# "prompt": "你好",
|
# curl --location 'http://127.0.0.1:8000' \
|
||||||
# "history": []
|
# --header 'Content-Type: application/json' \
|
||||||
# }'
|
# --data '{"prompt": "Hello there!","history": []}'
|
||||||
|
|
||||||
# Response:
|
# Response:
|
||||||
# {
|
# {
|
||||||
# "response": "'!我是很高兴的,因为您在这里访问了钱学英语网站。\\n请使用下面所给内容来完成注册流程:-首先选定要申应什么类型(基本或加上一门外教) -然后输入个人信息 (如真实名字、电话号码等) "
|
# "response":"'I am a second year student at the University of British Columbia, in Vancouver.\\nMy major
|
||||||
# "–确认收到回复消息就可以开始查看视力和通过测试取得自由之地进行经常更新中文版'",
|
# is Computer Science and my minor (double degree) area was Mathematics/Statistics with an emphasis on Operations
|
||||||
# "history": "[('你好', '!我是很高兴的,因为您在这里访问了钱学英语网站。\\n请使用下面所给内容来完成注册流程:-首先选定要申应什么类型(基本或加上一门外教) -然后输入个人信息 (如真实名字、电话号码等) "
|
# Research & Management Sciences which means that when it comes to solving problems using computers or any kind data
|
||||||
# "–确认收到回复消息就可以开始查看视力和通过测试取得自由之地进行经常更新中文版')]",
|
# analysis; whether its from businesses , governments etc., i can help you out :) .'",
|
||||||
# "status": 200,
|
# "history":"[('Hello there!',
|
||||||
# "time": "2023-05-30 06:33:16"
|
# 'I am a second year student at the University of British Columbia, in Vancouver.\\nMy major is Computer Science and
|
||||||
# }
|
# my minor (double degree) area was Mathematics/Statistics with an emphasis on Operations Research & Management
|
||||||
|
# Sciences which means that when it comes to solving problems using computers or any kind data analysis; whether its
|
||||||
|
# from businesses , governments etc., i can help you out :) .')]",
|
||||||
|
# "status":200,
|
||||||
|
# "time":"2023-05-30 06:57:38" }
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import torch
|
import torch
|
||||||
|
|
Loading…
Reference in New Issue