Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PLSC
提交
ac27672d
P
PLSC
项目概览
PaddlePaddle
/
PLSC
通知
11
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
5
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PLSC
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
5
Issue
5
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ac27672d
编写于
12月 17, 2019
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix pr
上级
a618517b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
24 addition
and
25 deletion
+24
-25
serving/client/face_service/face_service.py
serving/client/face_service/face_service.py
+6
-6
serving/server/plsc_serving/run/__init__.py
serving/server/plsc_serving/run/__init__.py
+18
-19
未找到文件。
serving/client/face_service/face_service.py
浏览文件 @
ac27672d
...
...
@@ -18,7 +18,6 @@ if is_py3:
class
FaceService
():
def
__init__
(
self
):
self
.
batch_size
=
16
self
.
con_list
=
[]
self
.
con_index
=
0
self
.
server_list
=
[]
...
...
@@ -58,10 +57,9 @@ class FaceService():
return
'retry'
def
encode
(
self
,
images
):
self
.
batch_size
=
len
(
images
)
request
=
[]
for
si
in
range
(
self
.
batch_size
):
request
.
append
(
b64encode
(
image
s
[
si
]
).
decode
(
'ascii'
))
for
image
in
range
(
images
):
request
.
append
(
b64encode
(
image
).
decode
(
'ascii'
))
#request
request
=
{
"base64_string"
:
request
}
...
...
@@ -81,10 +79,12 @@ class FaceService():
def
test
():
with
open
(
'./data/0000
0000
.jpg'
,
'rb'
)
as
f
:
with
open
(
'./data/0000
1464
.jpg'
,
'rb'
)
as
f
:
image
=
f
.
read
()
bc
=
FaceService
()
bc
.
connect
(
'127.0.0.1:8866'
)
for
i
in
image
:
print
(
"%x"
%
i
)
bc
.
connect
(
'127.0.0.1:8010'
)
result
=
bc
.
encode
([
image
])
print
(
result
[
0
])
bc
.
close
()
...
...
serving/server/plsc_serving/run/__init__.py
浏览文件 @
ac27672d
...
...
@@ -168,24 +168,23 @@ class PLSCServer():
def
get_model
(
self
,
model_name
):
server_path
=
self
.
get_path
()
if
True
:
tar_name
=
model_name
+
'.tar.gz'
model_url
=
self
.
model_url
+
'/'
+
tar_name
model_path
=
os
.
path
.
join
(
server_path
,
'data/model/paddle/fluid'
)
if
not
os
.
path
.
exists
(
model_path
):
os
.
makedirs
(
'data/model/paddle/fluid'
)
os
.
chdir
(
model_path
)
if
os
.
path
.
exists
(
model_name
):
pass
else
:
os
.
system
(
'wget '
+
model_url
+
' --no-check-certificate'
)
print
(
'Decompressing files ..'
)
tar
=
tarfile
.
open
(
tar_name
)
tar
.
extractall
()
tar
.
close
()
os
.
remove
(
tar_name
)
self
.
model_path_str
=
r
'model_data_path: "./data/model/paddle/fluid/'
+
model_name
+
r
'"'
tar_name
=
model_name
+
'.tar.gz'
model_url
=
self
.
model_url
+
'/'
+
tar_name
model_path
=
os
.
path
.
join
(
server_path
,
'data/model/paddle/fluid'
)
if
not
os
.
path
.
exists
(
model_path
):
os
.
makedirs
(
'data/model/paddle/fluid'
)
os
.
chdir
(
model_path
)
if
os
.
path
.
exists
(
model_name
):
pass
else
:
os
.
system
(
'wget '
+
model_url
+
' --no-check-certificate'
)
print
(
'Decompressing files ..'
)
tar
=
tarfile
.
open
(
tar_name
)
tar
.
extractall
()
tar
.
close
()
os
.
remove
(
tar_name
)
self
.
model_path_str
=
r
'model_data_path: "./data/model/paddle/fluid/'
+
model_name
+
r
'"'
os
.
chdir
(
self
.
get_path
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录