Commit e617fae1 authored by Martino Bertoni's avatar Martino Bertoni 🌋
Browse files

updated reference url, fixed local model logic

parent 8c73651f
......@@ -18,8 +18,8 @@ class Signaturizer(object):
"""Class loading TF-hub module and performing predictions."""
def __init__(self, model_name,
tf_version=1, verbose=True):
version='v1', local=False, tf_version='1', verbose=True):
"""Initialize the Signaturizer.
......@@ -30,6 +30,9 @@ class Signaturizer(object):
- 'GLOBAL' to get the global (i.e. horizontally stacked)
bioactivity signature.
base_url(str): The ChemicalChecker getModel API URL.
version(int): Signaturizer version.
local(bool): Wethere the specified model_name shoudl be
interpreted as a path to a local model.
tf_version(int): The Tesorflow version.
verbose(bool): If True some more information will be printed.
......@@ -47,15 +50,19 @@ class Signaturizer(object):
self.graph = tf.Graph()
with self.graph.as_default():
for model in models:
if local:
if os.path.isdir(model):
if self.verbose:
print('LOADING local:', model)
spec = hub.create_module_spec_from_saved_model(model)
module = hub.Module(spec, tags=['serve'])
raise Exception('Module path not found!')
url = base_url + '%s/%s' % (version, model)
if self.verbose:
print('LOADING remote:', base_url + model)
module = hub.Module(base_url + model, tags=['serve'])
print('LOADING remote:', url)
module = hub.Module(url, tags=['serve'])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment