Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
2aa55f14
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看板
提交
2aa55f14
编写于
5月 24, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix app
上级
f323db4a
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
16 addition
and
8 deletion
+16
-8
python/paddle_serving_app/__init__.py
python/paddle_serving_app/__init__.py
+0
-6
python/paddle_serving_app/reader/lac_reader.py
python/paddle_serving_app/reader/lac_reader.py
+7
-1
python/paddle_serving_app/reader/senta_reader.py
python/paddle_serving_app/reader/senta_reader.py
+9
-1
未找到文件。
python/paddle_serving_app/__init__.py
浏览文件 @
2aa55f14
...
...
@@ -11,10 +11,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from
.reader.chinese_bert_reader
import
ChineseBertReader
from
.reader.image_reader
import
ImageReader
,
File2Image
,
URL2Image
,
Sequential
,
Normalize
,
CenterCrop
,
Resize
,
PadStride
from
.reader.lac_reader
import
LACReader
from
.reader.senta_reader
import
SentaReader
from
.reader.imdb_reader
import
IMDBDataset
from
.models
import
ServingModels
from
.local_predict
import
Debugger
python/paddle_serving_app/reader/lac_reader.py
浏览文件 @
2aa55f14
...
...
@@ -48,10 +48,16 @@ def load_kv_dict(dict_path,
class
LACReader
(
object
):
"""data reader"""
def
__init__
(
self
,
dict_folder
):
def
__init__
(
self
,
dict_folder
=
""
):
# read dict
#basepath = os.path.abspath(__file__)
#folder = os.path.dirname(basepath)
if
dict_folder
==
""
:
dict_folder
=
"lac_dict"
if
not
os
.
path
.
exists
(
dict_folder
):
r
=
os
.
system
(
"wget https://paddle-serving.bj.bcebos.com/reader/lac/lac_dict.tar.gz --no-check-certificate && tar -xzvf lac_dict.tar.gz"
)
word_dict_path
=
os
.
path
.
join
(
dict_folder
,
"word.dic"
)
label_dict_path
=
os
.
path
.
join
(
dict_folder
,
"tag.dic"
)
replace_dict_path
=
os
.
path
.
join
(
dict_folder
,
"q2b.dic"
)
...
...
python/paddle_serving_app/reader/senta_reader.py
浏览文件 @
2aa55f14
...
...
@@ -14,10 +14,11 @@
import
sys
import
io
import
os
class
SentaReader
():
def
__init__
(
self
,
vocab_path
,
max_seq_len
=
20
):
def
__init__
(
self
,
vocab_path
=
""
,
max_seq_len
=
20
):
self
.
max_seq_len
=
max_seq_len
self
.
word_dict
=
self
.
load_vocab
(
vocab_path
)
...
...
@@ -25,6 +26,13 @@ class SentaReader():
"""
load the given vocabulary
"""
if
vocab_path
==
""
:
vocab_path
=
"senta_vocab.txt"
if
not
os
.
path
.
exists
(
vocab_path
):
r
=
os
.
system
(
" wget https://paddle-serving.bj.bcebos.com/reader/senta/senta_vocab.txt --no-check-certificate"
)
vocab
=
{}
with
io
.
open
(
vocab_path
,
'r'
,
encoding
=
'utf8'
)
as
f
:
for
line
in
f
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录