def getinferencingmodeldetails(): config = loadconfig() basedir =…
- User
def get_inferencing_model_details(): config = load_config() base_dir = config["general_settings"]["temp_models"] s3_model_inference_models = config["data_storage"]['models']['inferencing_models'] s3_support_inference_models = config["data_storage"]['models']['inferencing_models'] subdir_files = {} road_model_path = "" for root,dirs,files in os.walk(base_dir): if not dirs: for file in files: #Store the type of the model and the path to model as key value pair root = root + "/" for items in s3_model_inference_models: item_name = base_dir + "/" + items if item_name == root: subdir_files[os.path.join(root, file).split('/')[1]] = os.path.join(root, file) if items.startswith(CLASS_ROAD): if item_name == root: road_model_path = os.path.join(root, file) break return subdir_files, road_model_path update this code to set to road_model_path if its from s3_support_inference_models
- Assistant
Certainly! You want to update the
road_model_pathin your function to be set if the item is found insides3_support_inference_modelsinstead ofs3_model_inference_models.Here's the updated function with the necessary change:
def get_inferencing_model_details(): config = load_config() base_dir = config["general_settings"]["temp_models"] s3_model_inference_models = config["data_storage"]['models']['inferencing_models'] s3_support_inference_models = config["data_storage"]['models']['inferencing_models'] subdir_files = {} road_model_path = "" for root, dirs, files in os.walk(base_dir): if not dirs: for file in files: # Store the type of the model and the path to model as key value pair root_with_slash = root + "/" for items in s3_model_inference_models: item_name = base_dir + "/" + items if item_name == root_with_slash: subdir_files[os.path.join(root_with_slash, file).split('/')[1]] = os.path.join(root_with_slash, file) for items in s3_support_inference_models: if items.startswith(CLASS_ROAD): item_name = base_dir + "/" + items if item_name == root_with_slash: road_model_path = os.path.join(root_with_slash, file) break return subdir_files, road_model_path