Skip to content

Commit 4ab24f7

Browse files
committed
Fix bundle api
1 parent eeadc00 commit 4ab24f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/python/tfaas_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,11 @@ def delete(host, model, verbose=None, ckey=None, cert=None, capath=None):
228228

229229
def bundle(host, ifile, verbose=None, ckey=None, cert=None, capath=None):
230230
"bundle API uploads given bundle model files to TFaaS server"
231-
url = host + '/bundle'
231+
url = host + '/upload'
232232
client = '%s (%s)' % (TFAAS_CLIENT, os.environ.get('USER', ''))
233233
headers = {"User-Agent": client, "Content-Encoding": "gzip", "Content-Type": "application/octet-stream"}
234-
return getdata(url, headers, edata, ckey, cert, capath, verbose)
234+
data = open(ifile, 'rb').read()
235+
return getdata(url, headers, data, ckey, cert, capath, verbose)
235236

236237
def upload(host, ifile, verbose=None, ckey=None, cert=None, capath=None):
237238
"upload API uploads given model to TFaaS server"
@@ -334,6 +335,8 @@ def main():
334335
res = ''
335336
if opts.upload:
336337
res = upload(opts.url, opts.upload, opts.verbose, opts.ckey, opts.cert, opts.capath)
338+
if opts.bundle:
339+
res = bundle(opts.url, opts.bundle, opts.verbose, opts.ckey, opts.cert, opts.capath)
337340
elif opts.delete:
338341
res = delete(opts.url, opts.delete, opts.verbose, opts.ckey, opts.cert, opts.capath)
339342
elif opts.models:

0 commit comments

Comments
 (0)