Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
0a33d86d
S
Serving
项目概览
PaddlePaddle
/
Serving
12 个月 前同步成功
通知
183
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0a33d86d
编写于
3月 04, 2020
作者:
G
guru4elephant
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
make web_serve simple enough
上级
c1aa194b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
5 addition
and
44 deletion
+5
-44
python/examples/fit_a_line/README.md
python/examples/fit_a_line/README.md
+1
-1
python/paddle_serving_server/web_serve.py
python/paddle_serving_server/web_serve.py
+4
-43
未找到文件。
python/examples/fit_a_line/README.md
浏览文件 @
0a33d86d
...
@@ -13,7 +13,7 @@ python test_client.py uci_housing_client/serving_client_conf.prototxt
...
@@ -13,7 +13,7 @@ python test_client.py uci_housing_client/serving_client_conf.prototxt
# prediction through http service
# prediction through http service
Start a web service with default web service hosting modules
Start a web service with default web service hosting modules
```
shell
```
shell
python
-m
paddle_serving_server.web_serve
--model
uci_housing_model/
--thread
10
--name
uci
--port
9393
python
-m
paddle_serving_server.web_serve
--model
uci_housing_model/
--thread
10
--name
uci
--port
9393
--name
uci
```
```
Prediction through http post
Prediction through http post
...
...
python/paddle_serving_server/web_serve.py
浏览文件 @
0a33d86d
...
@@ -31,48 +31,9 @@ def parse_args():
...
@@ -31,48 +31,9 @@ def parse_args():
parser
.
add_argument
(
"--name"
,
type
=
str
,
default
=
"default"
,
help
=
"Default service name"
)
parser
.
add_argument
(
"--name"
,
type
=
str
,
default
=
"default"
,
help
=
"Default service name"
)
return
parser
.
parse_args
()
return
parser
.
parse_args
()
def
start_web_service
(
args
):
model
=
args
.
model
port
=
args
.
port
name
=
args
.
name
web_service
=
WebService
(
name
=
name
,
model
=
model
,
port
=
port
)
web_service
.
start_service
()
def
start_standard_model
(
args
):
thread_num
=
args
.
thread
model
=
args
.
model
port
=
args
.
port
workdir
=
args
.
workdir
device
=
args
.
device
if
model
==
""
:
print
(
"You must specify your serving model"
)
exit
(
-
1
)
import
paddle_serving_server
as
serving
op_maker
=
serving
.
OpMaker
()
read_op
=
op_maker
.
create
(
'general_reader'
)
general_infer_op
=
op_maker
.
create
(
'general_infer'
)
general_response_op
=
op_maker
.
create
(
'general_response'
)
op_seq_maker
=
serving
.
OpSeqMaker
()
op_seq_maker
.
add_op
(
read_op
)
op_seq_maker
.
add_op
(
general_infer_op
)
op_seq_maker
.
add_op
(
general_response_op
)
server
=
serving
.
Server
()
server
.
set_op_sequence
(
op_seq_maker
.
get_op_sequence
())
server
.
set_num_threads
(
thread_num
)
server
.
load_model_config
(
model
)
server
.
prepare_server
(
workdir
=
workdir
,
port
=
port
+
1
,
device
=
device
)
server
.
run_server
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
args
=
parse_args
()
args
=
parse_args
()
p_serving
=
Process
(
target
=
start_standard_model
,
args
=
(
args
,))
service
=
WebService
(
name
=
args
.
name
)
p_web_service
=
Process
(
target
=
start_web_service
,
args
=
(
args
,))
service
.
load_model_config
(
args
.
model
)
p_serving
.
start
()
service
.
prepare_server
(
workdir
=
args
.
workdir
,
port
=
args
.
port
,
device
=
args
.
device
)
p_web_service
.
start
()
service
.
run_server
()
p_web_service
.
join
()
p_serving
.
join
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录