diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2020-01-10 00:11:17 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2020-01-10 00:11:17 +0100 |
| commit | 347838598689a2111c5687ee6bc495519f190fea (patch) | |
| tree | 3ad247cf8028879a6ac6b1f4975d4d138390319e | |
| parent | c3ef63d9417dbc0b453e8799b96d07bc9ee47ef4 (diff) | |
fix
| -rw-r--r-- | cli/app/commands/cortex/upload.py | 6 | ||||
| -rw-r--r-- | cli/app/search/search_dense.py | 8 |
2 files changed, 9 insertions, 5 deletions
diff --git a/cli/app/commands/cortex/upload.py b/cli/app/commands/cortex/upload.py index c1b0a46..c176eb9 100644 --- a/cli/app/commands/cortex/upload.py +++ b/cli/app/commands/cortex/upload.py @@ -1,6 +1,7 @@ import click +import json -from app.utils.cortex_utils import upload_to_cortex +from app.utils.cortex_utils import upload_file_to_cortex @click.command('') @click.option('-i', '--input', 'opt_fp_in', required=True, @@ -12,4 +13,5 @@ def cli(ctx, opt_fp_in, opt_folder_id): """ Test uploading a file to Cortex """ - upload_to_cortex(opt_folder_id, opt_fp_in) + data = upload_file_to_cortex(opt_folder_id, opt_fp_in) + print(json.dumps(data, indent=2)) diff --git a/cli/app/search/search_dense.py b/cli/app/search/search_dense.py index e006fdd..c7cf078 100644 --- a/cli/app/search/search_dense.py +++ b/cli/app/search/search_dense.py @@ -4,7 +4,8 @@ import itertools import numpy as np from io import BytesIO import os -os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' +import json +os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from PIL import Image import scipy @@ -423,8 +424,9 @@ def find_dense_embedding_for_images(params): fp = BytesIO() image.save(fp, format='png') data = upload_bytes_to_cortex(params.folder_id, sample_fn + "-inverse.png", fp, "image/png") - if data is not None: - file_id = data['id'] + print(json.dumps(data, indent=2)) + if data is not None and 'files' in data: + file_id = data['files'][0]['id'] fp_out_pkl = os.path.join(app_cfg.DIR_VECTORS, "file_{}.pkl".format(file_id)) out_data = { 'id': file_id, |
