提交 77a32c04 编写于 作者: H HexToString

fix encryption doc

上级 347c3f2b
...@@ -13,9 +13,21 @@ sh get_data.sh ...@@ -13,9 +13,21 @@ sh get_data.sh
## Encrypt Model ## Encrypt Model
The `paddlepaddle` package is used in this example, you may need to download the corresponding package(`pip install paddlepaddle`). The `paddlepaddle` package is used in this example, you may need to download the corresponding package(`pip install paddlepaddle`).
[python encrypt.py](./encrypt.py)
[//file]:#encrypt.py
``` python
def serving_encryption():
inference_model_to_serving(
dirname="./uci_housing_model",
params_filename=None,
serving_server="encrypt_server",
serving_client="encrypt_client",
encryption=True)
``` ```
python encrypt.py dirname is the folder path where the model is located. If the parameter is discrete, it is unnecessary to specify params_filename, else you need to set params_filename='__params__'.
```
The key is stored in the `key` file, and the encrypted model file and server-side configuration file are stored in the `encrypt_server` directory. The key is stored in the `key` file, and the encrypted model file and server-side configuration file are stored in the `encrypt_server` directory.
client-side configuration file are stored in the `encrypt_client` directory. client-side configuration file are stored in the `encrypt_client` directory.
......
...@@ -12,9 +12,21 @@ sh get_data.sh ...@@ -12,9 +12,21 @@ sh get_data.sh
## 模型加密 ## 模型加密
本示例中使用了`paddlepaddle`包中的模块,需要进行下载(`pip install paddlepaddle`)。 本示例中使用了`paddlepaddle`包中的模块,需要进行下载(`pip install paddlepaddle`)。
```
python encrypt.py [python encrypt.py](./encrypt.py)
```
[//file]:#encrypt.py
``` python
def serving_encryption():
inference_model_to_serving(
dirname="./uci_housing_model",
params_filename=None,
serving_server="encrypt_server",
serving_client="encrypt_client",
encryption=True)
```
其中dirname为模型所在的文件夹路径,当参数为离散参数时,无须指定params_filename,当参数为为__params__时,需指定params_filename='__params__'.
密钥保存在`key`文件中,加密模型文件以及server端配置文件保存在`encrypt_server`目录下,client端配置文件保存在`encrypt_client`目录下。 密钥保存在`key`文件中,加密模型文件以及server端配置文件保存在`encrypt_server`目录下,client端配置文件保存在`encrypt_client`目录下。
## 启动加密预测服务 ## 启动加密预测服务
......
...@@ -18,6 +18,7 @@ from paddle_serving_client.io import inference_model_to_serving ...@@ -18,6 +18,7 @@ from paddle_serving_client.io import inference_model_to_serving
def serving_encryption(): def serving_encryption():
inference_model_to_serving( inference_model_to_serving(
dirname="./uci_housing_model", dirname="./uci_housing_model",
params_filename=None,
serving_server="encrypt_server", serving_server="encrypt_server",
serving_client="encrypt_client", serving_client="encrypt_client",
encryption=True) encryption=True)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册