|
22 | 22 | from clarifai.constants.input import MAX_UPLOAD_BATCH_SIZE |
23 | 23 | from clarifai.errors import UserError |
24 | 24 | from clarifai.utils.logging import logger |
25 | | -from clarifai.utils.misc import BackoffIterator, Chunker |
| 25 | +from clarifai.utils.misc import BackoffIterator, Chunker, clean_input_id |
26 | 26 |
|
27 | 27 |
|
28 | 28 | class Inputs(Lister, BaseClient): |
@@ -282,7 +282,7 @@ def get_image_inputs_from_folder(folder_path: str, dataset_id: str = None, |
282 | 282 | for filename in os.listdir(folder_path): |
283 | 283 | if filename.split('.')[-1] not in ['jpg', 'jpeg', 'png', 'tiff', 'webp']: |
284 | 284 | continue |
285 | | - input_id = filename.split('.')[0] |
| 285 | + input_id = clean_input_id(filename.split('.')[0]) |
286 | 286 | image_pb = resources_pb2.Image(base64=open(os.path.join(folder_path, filename), 'rb').read()) |
287 | 287 | input_protos.append( |
288 | 288 | Inputs._get_proto( |
@@ -473,7 +473,7 @@ def get_text_inputs_from_folder(folder_path: str, dataset_id: str = None, |
473 | 473 | for filename in os.listdir(folder_path): |
474 | 474 | if filename.split('.')[-1] != 'txt': |
475 | 475 | continue |
476 | | - input_id = filename.split('.')[0] |
| 476 | + input_id = clean_input_id(filename.split('.')[0]) |
477 | 477 | text_pb = resources_pb2.Text(raw=open(os.path.join(folder_path, filename), 'rb').read()) |
478 | 478 | input_protos.append( |
479 | 479 | Inputs._get_proto( |
|
0 commit comments