From b349d2f07a7e4f94ab69bf63854023053d1ac254 Mon Sep 17 00:00:00 2001 From: spbeach46 Date: Fri, 17 Dec 2021 22:26:55 -0700 Subject: [PATCH] added separate dict_pics function for changing target training images url on the fly --- ebay_api.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ebay_api.py b/ebay_api.py index db5954c..39979ef 100644 --- a/ebay_api.py +++ b/ebay_api.py @@ -404,13 +404,18 @@ class PreProcessing: splits, etc. ''' - def stt_training(self, dict_pics, expanded_class, expanded_dropd): + def stt_training(self): ''' Source to target training. Replaces source image URL with target URL determined by values in dict_pics variable. ''' - pass + target_dir = os.getcwd() + with open('temp_pics_source_list.txt') as f: + temp_pics_source_list = json.load(f) + temp_dict_pics = {k:target_dir + os.sep + re.search(r'[^/]+(?=/\$_|.jpg)', k, re.IGNORECASE).group() + '.jpg' for k in temp_pics_source_list} + print("{source:target} dictionary created @ " + os.getcwd() + os.sep + 'training_images') + return temp_dict_pics # TODO pipeline gameplan: 5 files: dict_pics.txt,raw_json.txt, raw_json.csv, expanded_class.csv, expanded_dropd.csv # cont... open raw_json.txt and append, same with csv --> process new data --> pull out image source+dest and expand new dfs for the additional pictures