未验证 提交 b96f307d 编写于 作者: D Dong Daxiang 提交者: GitHub

Merge pull request #204 from MRXLT/general-server-v1

add client lib
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from .serving_client import PredictorClient import paddle_serving_client
import os
from .proto import sdk_configure_pb2 as sdk from .proto import sdk_configure_pb2 as sdk
from .proto import general_model_config_pb2 as m_config from .proto import general_model_config_pb2 as m_config
import google.protobuf.text_format import google.protobuf.text_format
...@@ -75,8 +76,17 @@ class Client(object): ...@@ -75,8 +76,17 @@ class Client(object):
self.feed_shapes_ = [] self.feed_shapes_ = []
self.feed_types_ = {} self.feed_types_ = {}
self.feed_names_to_idx_ = {} self.feed_names_to_idx_ = {}
self.rpath()
def rpath(self):
lib_path = os.path.dirname(paddle_serving_client.__file__)
client_path = os.path.join(lib_path, 'serving_client.so')
lib_path = os.path.join(lib_path, 'lib')
os.popen('patchelf --set-rpath {} {}'.format(lib_path, client_path))
def load_client_config(self, path): def load_client_config(self, path):
from .serving_client import PredictorClient
model_conf = m_config.GeneralModelConfig() model_conf = m_config.GeneralModelConfig()
f = open(path, 'r') f = open(path, 'r')
model_conf = google.protobuf.text_format.Merge( model_conf = google.protobuf.text_format.Merge(
......
...@@ -12,6 +12,6 @@ ...@@ -12,6 +12,6 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
""" Paddle Serving Client version string """ """ Paddle Serving Client version string """
serving_client_version = "0.1.0" serving_client_version = "0.1.1"
serving_server_version = "0.1.0" serving_server_version = "0.1.0"
module_proto_version = "0.1.0" module_proto_version = "0.1.0"
...@@ -17,6 +17,7 @@ from __future__ import division ...@@ -17,6 +17,7 @@ from __future__ import division
from __future__ import print_function from __future__ import print_function
import platform import platform
import os
from setuptools import setup, Distribution, Extension from setuptools import setup, Distribution, Extension
from setuptools import find_packages from setuptools import find_packages
...@@ -26,7 +27,15 @@ from paddle_serving_client.version import serving_client_version ...@@ -26,7 +27,15 @@ from paddle_serving_client.version import serving_client_version
def python_version(): def python_version():
return [int(v) for v in platform.python_version().split(".")] return [int(v) for v in platform.python_version().split(".")]
def copy_lib():
os.popen('mkdir -p paddle_serving_client/lib')
for lib in ['libpython2.7.so.1.0', 'libssl.so.10', 'libcrypto.so.10']:
r = os.popen('whereis {}'.format(lib))
text = r.read()
os.popen('cp {} ./paddle_serving_client/lib'.format(text.strip().split(' ')[1]))
max_version, mid_version, min_version = python_version() max_version, mid_version, min_version = python_version()
copy_lib()
REQUIRED_PACKAGES = [ REQUIRED_PACKAGES = [
'six >= 1.10.0', 'protobuf >= 3.1.0','paddlepaddle' 'six >= 1.10.0', 'protobuf >= 3.1.0','paddlepaddle'
...@@ -36,8 +45,8 @@ packages=['paddle_serving_client', ...@@ -36,8 +45,8 @@ packages=['paddle_serving_client',
'paddle_serving_client.proto', 'paddle_serving_client.proto',
'paddle_serving_client.io', 'paddle_serving_client.io',
'paddle_serving_client.metric', 'paddle_serving_client.metric',
'paddle_serving_client.utils'] 'paddle_serving_client.utils',]
package_data={'paddle_serving_client': ['serving_client.so']} package_data={'paddle_serving_client': ['serving_client.so','lib/*'],}
package_dir={'paddle_serving_client': package_dir={'paddle_serving_client':
'${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client', '${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client',
'paddle_serving_client.proto': 'paddle_serving_client.proto':
...@@ -47,7 +56,7 @@ package_dir={'paddle_serving_client': ...@@ -47,7 +56,7 @@ package_dir={'paddle_serving_client':
'paddle_serving_client.metric': 'paddle_serving_client.metric':
'${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/metric', '${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/metric',
'paddle_serving_client.utils': 'paddle_serving_client.utils':
'${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/utils'} '${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/utils',}
setup( setup(
name='paddle-serving-client', name='paddle-serving-client',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册