Browse Source

move paddlex/restful to paddlex_restful/restful

wangsiyuan06 4 năm trước cách đây
mục cha
commit
2ca53e570e
51 tập tin đã thay đổi với 202 bổ sung38 xóa
  1. 1 1
      docs/gui/index.rst
  2. 1 1
      docs/gui/restful/index.rst
  3. 5 5
      docs/gui/restful/introduction.md
  4. 1 1
      docs/gui/restful/quick_start.md
  5. 1 1
      docs/gui/restful/restful.md
  6. 0 1
      paddlex/__init__.py
  7. 1 27
      paddlex/command.py
  8. 15 0
      paddlex_restful/__init__.py
  9. 63 0
      paddlex_restful/command.py
  10. 0 0
      paddlex_restful/restful/README.md
  11. 0 0
      paddlex_restful/restful/__init__.py
  12. 14 0
      paddlex_restful/restful/app.py
  13. 0 0
      paddlex_restful/restful/dataset/__init__.py
  14. 0 0
      paddlex_restful/restful/dataset/cls_dataset.py
  15. 0 0
      paddlex_restful/restful/dataset/dataset.py
  16. 0 0
      paddlex_restful/restful/dataset/datasetbase.py
  17. 0 0
      paddlex_restful/restful/dataset/det_dataset.py
  18. 0 0
      paddlex_restful/restful/dataset/ins_seg_dataset.py
  19. 0 0
      paddlex_restful/restful/dataset/operate.py
  20. 0 0
      paddlex_restful/restful/dataset/seg_dataset.py
  21. 0 0
      paddlex_restful/restful/dataset/utils.py
  22. 14 0
      paddlex_restful/restful/demo.py
  23. 0 0
      paddlex_restful/restful/dir.py
  24. 0 0
      paddlex_restful/restful/frontend_demo/paddlex_restful_demo.html
  25. 14 0
      paddlex_restful/restful/model.py
  26. 0 0
      paddlex_restful/restful/project/__init__.py
  27. 0 0
      paddlex_restful/restful/project/evaluate/__init__.py
  28. 0 0
      paddlex_restful/restful/project/evaluate/classification.py
  29. 0 0
      paddlex_restful/restful/project/evaluate/detection.py
  30. 0 0
      paddlex_restful/restful/project/evaluate/draw_pred_result.py
  31. 0 0
      paddlex_restful/restful/project/evaluate/segmentation.py
  32. 0 0
      paddlex_restful/restful/project/operate.py
  33. 0 0
      paddlex_restful/restful/project/project.py
  34. 0 0
      paddlex_restful/restful/project/prune/__init__.py
  35. 0 0
      paddlex_restful/restful/project/prune/classification.py
  36. 0 0
      paddlex_restful/restful/project/prune/detection.py
  37. 0 0
      paddlex_restful/restful/project/prune/segmentation.py
  38. 0 0
      paddlex_restful/restful/project/task.py
  39. 0 0
      paddlex_restful/restful/project/train/__init__.py
  40. 0 0
      paddlex_restful/restful/project/train/classification.py
  41. 0 0
      paddlex_restful/restful/project/train/detection.py
  42. 0 0
      paddlex_restful/restful/project/train/params.py
  43. 0 0
      paddlex_restful/restful/project/train/params_v2.py
  44. 0 0
      paddlex_restful/restful/project/train/segmentation.py
  45. 0 0
      paddlex_restful/restful/project/visualize.py
  46. 14 0
      paddlex_restful/restful/system.py
  47. 14 0
      paddlex_restful/restful/utils.py
  48. 14 0
      paddlex_restful/restful/workspace.proto
  49. 14 0
      paddlex_restful/restful/workspace.py
  50. 14 0
      paddlex_restful/restful/workspace_pb2.py
  51. 2 1
      setup.py

+ 1 - 1
docs/gui/index.rst

@@ -51,7 +51,7 @@ PaddleX RESTful是基于PaddleX开发的RESTful API。
 
 同样您还可以根据RESTful API来开发自己的可视化界面。
 
-**paddlex --start_restful --port [端口号] --workspace_dir [工作空间地址]**
+**paddlex_restful --start_restful --port [端口号] --workspace_dir [工作空间地址]**
 
 PaddleX Remote GUI
 ---------------------------------------

+ 1 - 1
docs/gui/restful/index.rst

@@ -9,7 +9,7 @@ PaddleX RESTful是基于PaddleX开发的RESTful API。
 同样您还可以根据RESTful API来开发自己的可视化界面。
 
 ```
-paddlex --start_restful --port 8081 --workspace_dir D:\Workspace
+paddlex_restful --start_restful --port 8081 --workspace_dir D:\Workspace
 ```
 
 **注意:请确保启动RESTful的端口未被防火墙限制**

+ 5 - 5
docs/gui/restful/introduction.md

@@ -4,7 +4,7 @@ PaddleX RESTful是基于PaddleX开发的RESTful API。
 对于开发者来说可以通过如下指令启动PaddleX RESTful服务  
 
 ```
-paddlex --start_restful --port [端口号] --workspace_dir [工作空间地址]   
+paddlex_restful --start_restful --port [端口号] --workspace_dir [工作空间地址]   
 ```
   
 对于设置workspace在HOME目录的wk文件夹下,RESTful服务端口为8080的命令参考如下:
@@ -39,7 +39,7 @@ pip install pycuda
 
 #### step2:开启RESTful 服务
 ```
-paddlex --start_restful --port [端口号] --workspace_dir [工作空间地址]
+paddlex_restful --start_restful --port [端口号] --workspace_dir [工作空间地址]
 ```
 
 #### setp3:根据上面的链接下载支持RESTful版本的GUI
@@ -50,7 +50,7 @@ paddlex --start_restful --port [端口号] --workspace_dir [工作空间地址]
 
 ## PaddleX Web Demo
 PaddleX Web Demo是针对PaddleX RESTful开发的Web可视化客户端。  
-[Wed demo传送门](https://github.com/PaddlePaddle/PaddleX/blob/develop/paddlex/restful/frontend_demo/paddlex_restful_demo.html)
+[Wed demo传送门](https://github.com/PaddlePaddle/PaddleX/blob/develop/paddlex_resful/restful/frontend_demo/paddlex_restful_demo.html)
 
 ### Web DEMO使用流程
 
@@ -65,10 +65,10 @@ pip install pycuda
 
 #### step2:开启RESTful 服务
 ```
-paddlex --start_restful --port [端口号] --workspace_dir [工作空间地址]
+paddlex_restful --start_restful --port [端口号] --workspace_dir [工作空间地址]
 ```
 
-#### step3:通过浏览器打开[Demo](https://github.com/PaddlePaddle/PaddleX/blob/develop/paddlex/restful/frontend_demo/paddlex_restful_demo.html)文件
+#### step3:通过浏览器打开[Demo](https://github.com/PaddlePaddle/PaddleX/blob/develop/paddlex_restful/restful/frontend_demo/paddlex_restful_demo.html)文件
 
 
 #### step4:点击设置服务器信息,填写正确的后端ip与端口

+ 1 - 1
docs/gui/restful/quick_start.md

@@ -8,7 +8,7 @@
 
 ## 服务端启动PaddleX RESTful服务
 ```
- paddlex --start_restful --port [端口号] --workspace_dir [工作空间目录]
+ paddlex_restful --start_restful --port [端口号] --workspace_dir [工作空间目录]
 ```  
 
 ## 客户端请求服务端

+ 1 - 1
docs/gui/restful/restful.md

@@ -18,7 +18,7 @@
 
 通过如下命令启动PaddleX的RESTful服务,同时会初始化工作空间,初始化工作空间主要做载入工作空间内已有的数据集、项目等模块的信息。初始化工作空间后就可以正常调用其他的RESTful API,所有新建的数据集、项目等数据都会保存在此工作空间目录下面  
 ```
- paddlex --start_restful --port [端口号] --workspace_dir [工作空间目录]
+ paddlex_restful --start_restful --port [端口号] --workspace_dir [工作空间目录]
 ```  
 
 

+ 0 - 1
paddlex/__init__.py

@@ -44,7 +44,6 @@ from . import slim
 from . import converter
 from . import tools
 from . import deploy
-from . import restful
 
 try:
     import pycocotools

+ 1 - 27
paddlex/command.py

@@ -120,24 +120,6 @@ def arg_parser():
         "-tv",
         default=None,
         help="define the value of test dataset(E.g 0.1)")
-    parser.add_argument(
-        "--start_restful",
-        "-sr",
-        action="store_true",
-        default=False,
-        help="start paddlex restful server")
-    parser.add_argument(
-        "--port",
-        "--pt",
-        type=_text_type,
-        default=None,
-        help="set the port of restful server")
-    parser.add_argument(
-        "--workspace_dir",
-        "--wd",
-        type=_text_type,
-        default=None,
-        help="set the workspace dir of restful server")
 
     return parser
 
@@ -245,15 +227,7 @@ def main():
         pdx.tools.split.dataset_split(dataset_dir, dataset_format, val_value,
                                       test_value, save_dir)
 
-    if args.start_restful:
-
-        assert args.port is not None, "--port should be defined while start restful server"
-        assert args.workspace_dir, "--workspace_dir should be define while start restful server"
-
-        port = args.port
-        workspace_dir = args.workspace_dir
-
-        pdx.restful.app.run(port, workspace_dir)
+    
 
 
 if __name__ == "__main__":

+ 15 - 0
paddlex_restful/__init__.py

@@ -0,0 +1,15 @@
+# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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 . import restful

+ 63 - 0
paddlex_restful/command.py

@@ -0,0 +1,63 @@
+# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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 six import text_type as _text_type
+import argparse
+import sys
+import os
+import os.path as osp
+
+
+def arg_parser():
+    parser = argparse.ArgumentParser()
+    parser.add_argument(
+        "--start_restful",
+        "-sr",
+        action="store_true",
+        default=False,
+        help="start paddlex restful server")
+    parser.add_argument(
+        "--port",
+        "--pt",
+        type=_text_type,
+        default=None,
+        help="set the port of restful server")
+    parser.add_argument(
+        "--workspace_dir",
+        "--wd",
+        type=_text_type,
+        default=None,
+        help="set the workspace dir of restful server")
+    return parser
+
+def main():
+    if len(sys.argv) < 2:
+        print("Use command 'paddlex_restful -h` to print the help information\n")
+        return
+    parser = arg_parser()
+    args = parser.parse_args()
+
+    if args.start_restful:
+        import paddlex_restful as pdxr
+        assert args.port is not None, "--port should be defined while start restful server"
+        assert args.workspace_dir, "--workspace_dir should be define while start restful server"
+
+        port = args.port
+        workspace_dir = args.workspace_dir
+
+        pdxr.restful.app.run(port, workspace_dir)
+
+
+if __name__ == "__main__":
+    main()

+ 0 - 0
paddlex/restful/README.md → paddlex_restful/restful/README.md


+ 0 - 0
paddlex/restful/__init__.py → paddlex_restful/restful/__init__.py


+ 14 - 0
paddlex/restful/app.py → paddlex_restful/restful/app.py

@@ -1,3 +1,17 @@
+# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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 flask import Flask, request, render_template, send_from_directory, jsonify, session, send_file
 from werkzeug.utils import secure_filename
 from flask_cors import CORS

+ 0 - 0
paddlex/restful/dataset/__init__.py → paddlex_restful/restful/dataset/__init__.py


+ 0 - 0
paddlex/restful/dataset/cls_dataset.py → paddlex_restful/restful/dataset/cls_dataset.py


+ 0 - 0
paddlex/restful/dataset/dataset.py → paddlex_restful/restful/dataset/dataset.py


+ 0 - 0
paddlex/restful/dataset/datasetbase.py → paddlex_restful/restful/dataset/datasetbase.py


+ 0 - 0
paddlex/restful/dataset/det_dataset.py → paddlex_restful/restful/dataset/det_dataset.py


+ 0 - 0
paddlex/restful/dataset/ins_seg_dataset.py → paddlex_restful/restful/dataset/ins_seg_dataset.py


+ 0 - 0
paddlex/restful/dataset/operate.py → paddlex_restful/restful/dataset/operate.py


+ 0 - 0
paddlex/restful/dataset/seg_dataset.py → paddlex_restful/restful/dataset/seg_dataset.py


+ 0 - 0
paddlex/restful/dataset/utils.py → paddlex_restful/restful/dataset/utils.py


+ 14 - 0
paddlex/restful/demo.py → paddlex_restful/restful/demo.py

@@ -1,3 +1,17 @@
+# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
 import os
 import json
 from os import path as osp

+ 0 - 0
paddlex/restful/dir.py → paddlex_restful/restful/dir.py


+ 0 - 0
paddlex/restful/frontend_demo/paddlex_restful_demo.html → paddlex_restful/restful/frontend_demo/paddlex_restful_demo.html


+ 14 - 0
paddlex/restful/model.py → paddlex_restful/restful/model.py

@@ -1,3 +1,17 @@
+# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
 import time
 import os
 import shutil

+ 0 - 0
paddlex/restful/project/__init__.py → paddlex_restful/restful/project/__init__.py


+ 0 - 0
paddlex/restful/project/evaluate/__init__.py → paddlex_restful/restful/project/evaluate/__init__.py


+ 0 - 0
paddlex/restful/project/evaluate/classification.py → paddlex_restful/restful/project/evaluate/classification.py


+ 0 - 0
paddlex/restful/project/evaluate/detection.py → paddlex_restful/restful/project/evaluate/detection.py


+ 0 - 0
paddlex/restful/project/evaluate/draw_pred_result.py → paddlex_restful/restful/project/evaluate/draw_pred_result.py


+ 0 - 0
paddlex/restful/project/evaluate/segmentation.py → paddlex_restful/restful/project/evaluate/segmentation.py


+ 0 - 0
paddlex/restful/project/operate.py → paddlex_restful/restful/project/operate.py


+ 0 - 0
paddlex/restful/project/project.py → paddlex_restful/restful/project/project.py


+ 0 - 0
paddlex/restful/project/prune/__init__.py → paddlex_restful/restful/project/prune/__init__.py


+ 0 - 0
paddlex/restful/project/prune/classification.py → paddlex_restful/restful/project/prune/classification.py


+ 0 - 0
paddlex/restful/project/prune/detection.py → paddlex_restful/restful/project/prune/detection.py


+ 0 - 0
paddlex/restful/project/prune/segmentation.py → paddlex_restful/restful/project/prune/segmentation.py


+ 0 - 0
paddlex/restful/project/task.py → paddlex_restful/restful/project/task.py


+ 0 - 0
paddlex/restful/project/train/__init__.py → paddlex_restful/restful/project/train/__init__.py


+ 0 - 0
paddlex/restful/project/train/classification.py → paddlex_restful/restful/project/train/classification.py


+ 0 - 0
paddlex/restful/project/train/detection.py → paddlex_restful/restful/project/train/detection.py


+ 0 - 0
paddlex/restful/project/train/params.py → paddlex_restful/restful/project/train/params.py


+ 0 - 0
paddlex/restful/project/train/params_v2.py → paddlex_restful/restful/project/train/params_v2.py


+ 0 - 0
paddlex/restful/project/train/segmentation.py → paddlex_restful/restful/project/train/segmentation.py


+ 0 - 0
paddlex/restful/project/visualize.py → paddlex_restful/restful/project/visualize.py


+ 14 - 0
paddlex/restful/system.py → paddlex_restful/restful/system.py

@@ -1,3 +1,17 @@
+# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
 import sys
 import os
 import psutil

+ 14 - 0
paddlex/restful/utils.py → paddlex_restful/restful/utils.py

@@ -1,3 +1,17 @@
+# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
 import psutil
 import shutil
 import os

+ 14 - 0
paddlex/restful/workspace.proto → paddlex_restful/restful/workspace.proto

@@ -1,3 +1,17 @@
+// Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// 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.
+
 syntax = "proto3";
 package suitebackend;
 

+ 14 - 0
paddlex/restful/workspace.py → paddlex_restful/restful/workspace.py

@@ -1,3 +1,17 @@
+# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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 . import workspace_pb2 as w
 from .utils import get_logger
 from .dir import *

+ 14 - 0
paddlex/restful/workspace_pb2.py → paddlex_restful/restful/workspace_pb2.py

@@ -1,3 +1,17 @@
+# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# 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.
+
 # -*- coding: utf-8 -*-
 # Generated by the protocol buffer compiler.  DO NOT EDIT!
 # source: workspace.proto

+ 2 - 1
setup.py

@@ -40,4 +40,5 @@ setuptools.setup(
         "Operating System :: OS Independent",
     ],
     license='Apache 2.0',
-    entry_points={'console_scripts': ['paddlex=paddlex.command:main', ]})
+    entry_points={'console_scripts': ['paddlex=paddlex.command:main', 'paddlex_restful=paddlex_restful.command:main']})
+