提交 ac27672d 编写于 作者: M MRXLT

fix pr

上级 a618517b
......@@ -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(images[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/00000000.jpg', 'rb') as f:
with open('./data/00001464.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()
......
......@@ -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.
先完成此消息的编辑!
想要评论请 注册