Skip to content

Commit

Permalink
Fix bundle api
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Apr 5, 2021
1 parent eeadc00 commit 4ab24f7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/python/tfaas_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,11 @@ def delete(host, model, verbose=None, ckey=None, cert=None, capath=None):

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

def upload(host, ifile, verbose=None, ckey=None, cert=None, capath=None):
"upload API uploads given model to TFaaS server"
Expand Down Expand Up @@ -334,6 +335,8 @@ def main():
res = ''
if opts.upload:
res = upload(opts.url, opts.upload, opts.verbose, opts.ckey, opts.cert, opts.capath)
if opts.bundle:
res = bundle(opts.url, opts.bundle, opts.verbose, opts.ckey, opts.cert, opts.capath)
elif opts.delete:
res = delete(opts.url, opts.delete, opts.verbose, opts.ckey, opts.cert, opts.capath)
elif opts.models:
Expand Down

0 comments on commit 4ab24f7

Please sign in to comment.