Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
f5a809b5
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
186
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看板
提交
f5a809b5
编写于
4月 22, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add run_flask && fix HTTP demo
上级
61ed03a0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
1 deletion
+41
-1
python/examples/bert/bert_web_service.py
python/examples/bert/bert_web_service.py
+1
-0
python/examples/imagenet/image_classification_service.py
python/examples/imagenet/image_classification_service.py
+1
-0
python/examples/imagenet/image_classification_service_gpu.py
python/examples/imagenet/image_classification_service_gpu.py
+2
-1
python/examples/imdb/text_classify_service.py
python/examples/imdb/text_classify_service.py
+1
-0
python/paddle_serving_server/web_service.py
python/paddle_serving_server/web_service.py
+18
-0
python/paddle_serving_server_gpu/web_service.py
python/paddle_serving_server_gpu/web_service.py
+18
-0
未找到文件。
python/examples/bert/bert_web_service.py
浏览文件 @
f5a809b5
...
...
@@ -36,3 +36,4 @@ bert_service.set_gpus(gpu_ids)
bert_service
.
prepare_server
(
workdir
=
"workdir"
,
port
=
int
(
sys
.
argv
[
2
]),
device
=
"gpu"
)
bert_service
.
run_server
()
bert_service
.
run_flask
()
python/examples/imagenet/image_classification_service.py
浏览文件 @
f5a809b5
...
...
@@ -47,3 +47,4 @@ image_service.load_model_config(sys.argv[1])
image_service
.
prepare_server
(
workdir
=
sys
.
argv
[
2
],
port
=
int
(
sys
.
argv
[
3
]),
device
=
"cpu"
)
image_service
.
run_server
()
image_service
.
run_flask
()
python/examples/imagenet/image_classification_service_gpu.py
浏览文件 @
f5a809b5
...
...
@@ -12,12 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from
paddle_serving_server_gpu.web_service
import
WebService
import
sys
import
cv2
import
base64
import
numpy
as
np
from
image_reader
import
ImageReader
from
paddle_serving_server_gpu.web_service
import
WebService
class
ImageService
(
WebService
):
...
...
@@ -49,3 +49,4 @@ image_service.set_gpus("0,1")
image_service
.
prepare_server
(
workdir
=
sys
.
argv
[
2
],
port
=
int
(
sys
.
argv
[
3
]),
device
=
"gpu"
)
image_service
.
run_server
()
image_service
.
run_flask
()
python/examples/imdb/text_classify_service.py
浏览文件 @
f5a809b5
...
...
@@ -39,3 +39,4 @@ imdb_service.prepare_server(
workdir
=
sys
.
argv
[
2
],
port
=
int
(
sys
.
argv
[
3
]),
device
=
"cpu"
)
imdb_service
.
prepare_dict
({
"dict_file_path"
:
sys
.
argv
[
4
]})
imdb_service
.
run_server
()
imdb_service
.
run_flask
()
python/paddle_serving_server/web_service.py
浏览文件 @
f5a809b5
...
...
@@ -108,6 +108,24 @@ class WebService(object):
p_rpc
=
Process
(
target
=
self
.
_launch_rpc_service
)
p_rpc
.
start
()
def
run_flask
(
self
):
app_instance
=
Flask
(
__name__
)
@
app_instance
.
before_first_request
def
init
():
self
.
_launch_web_service
()
service_name
=
"/"
+
self
.
name
+
"/prediction"
@
app_instance
.
route
(
service_name
,
methods
=
[
"POST"
])
def
run
():
return
self
.
get_prediction
(
request
)
app_instance
.
run
(
host
=
"0.0.0.0"
,
port
=
self
.
port
,
threaded
=
False
,
processes
=
4
)
def
preprocess
(
self
,
feed
=
{},
fetch
=
[]):
return
feed
,
fetch
...
...
python/paddle_serving_server_gpu/web_service.py
浏览文件 @
f5a809b5
...
...
@@ -143,6 +143,24 @@ class WebService(object):
for
p
in
server_pros
:
p
.
start
()
def
run_flask
(
self
):
app_instance
=
Flask
(
__name__
)
@
app_instance
.
before_first_request
def
init
():
self
.
_launch_web_service
()
service_name
=
"/"
+
self
.
name
+
"/prediction"
@
app_instance
.
route
(
service_name
,
methods
=
[
"POST"
])
def
run
():
return
self
.
get_prediction
(
request
)
app_instance
.
run
(
host
=
"0.0.0.0"
,
port
=
self
.
port
,
threaded
=
False
,
processes
=
4
)
def
preprocess
(
self
,
feed
=
{},
fetch
=
[]):
return
feed
,
fetch
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录