conda create -n article_speech_extractor python=3.6
source activate article_speech_extractor
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple uwsgi flask simplejson pandas flask_cors
- uwsgi
- flask
- simplejson
- pandas
- flask_cors
-
下载
cd ltp_installers/mac wget https://github.com/qiuhuadong2015/resources/raw/master/pyltp_mac.zip unzip pyltp_mac.zip或从 https://pan.baidu.com/s/1QUeBt6oIJEfmH3u5vHlUdw 下载pyltp_mac.zip到任意位置,再解压得到pyltp文件夹
-
安装
cd pyltp python setup.py install
pyltp-0.2.1-cp36-cp36m-win_amd64.whl 来自网友分享
cd ltp_installer/windows64
python install pyltp-0.2.1-cp36-cp36m-win_amd64.whl
Dockerfile来自https://github.com/HIT-SCIR/ltp
cd ltp_docker
docker build -t ltp/ltp .启动
docker run -d -p 8080:12345 ltp/ltp /ltp_server --last-stage all测试
curl -d "s=姑姑说:我好想过过过儿过过的生活。&f=xml&t=all" http://127.0.0.1:8080/ltp下载链接
http://ltp.ai/download.html
mac、linux选择ltp_data_v3.4.0.zip
windows64位选择ltp-3.4.0-win-x64-Release.zip
解压到任意位置,修改main.py开头的代码为解压后文件夹路径
# 根据下载模型存放位置修改
LTP_DATA_PATH = '/Users/qiuhuadong/ltp_data_v3.4.0'修改uwsgi.ini中的项目路径
chdir = 【article_speech_extractor项目路径】/webapp
socket = 【article_speech_extractor项目路径】/webapp/myproject.sock
logto = 【article_speech_extractor项目路径】/webapp/myproject.log
pidfile = 【article_speech_extractor项目路径】/webapp/uwsgi.pid
运行
cd webapp
uwsgi --ini uwsgi.iniCtrl+C 停止运行
localhost:5000/api
web服务启动成功则显示
hello api
curl -X POST --header "Content-Type: application/json" --header "Accept: application/json" -d "{
\"article\": \"小明说今天天气真好!\"
}" "http://localhost:5000/api/get"程序运行正常则显示
{
"result": [
{
"object": "今天天气真好!",
"predicate": "说",
"subject": "小明"
}
]
}forked from crescent0409/vue-ts-page
git clone https://github.com/qiuhuadong2015/vue-ts-page
cd vue-ts-page
npm run build
构建得到dist目录
brew install nginx
打开文件
/usr/local/etc/nginx/nginx.conf
编辑内容
listen 80;
server_name localhost;
location / {
alias /usr/local/var/www/dist/;
index index.html index.htm;
}
location /api {
include uwsgi_params;
uwsgi_pass localhost:5000;
}
nginx
首页
结果
nginx -s stop

