Skip to content

Commit

Permalink
Add bundle API
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Apr 4, 2021
1 parent 0b9a4df commit 236bb36
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/python/tfaas_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def __init__(self):
dest="url", default="", help="TFaaS URL")
self.parser.add_argument("--upload", action="store",
dest="upload", default="", help="upload model to TFaaS")
self.parser.add_argument("--bundle", action="store",
dest="bundle", default="", help="upload bundle ML files to TFaaS")
self.parser.add_argument("--predict", action="store",
dest="predict", default="", help="fetch prediction from TFaaS")
self.parser.add_argument("--image", action="store",
Expand Down Expand Up @@ -224,6 +226,13 @@ def delete(host, model, verbose=None, ckey=None, cert=None, capath=None):
headers['Content-Type'] = form.get_content_type()
return getdata(url, headers, edata, ckey, cert, capath, verbose, method='DELETE')

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'
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)

def upload(host, ifile, verbose=None, ckey=None, cert=None, capath=None):
"upload API uploads given model to TFaaS server"
url = host + '/upload'
Expand Down

0 comments on commit 236bb36

Please sign in to comment.