Commit 506a6baf authored by lucas_miranda's avatar lucas_miranda
Browse files

Replaced pickle with json for security reasons

parent 5e4dbf7b
Pipeline #97120 passed with stages
in 36 minutes and 18 seconds
......@@ -17,9 +17,9 @@ from tensorboard.plugins.hparams import api as hp
from typing import Tuple, Union, Any, List
import deepof.hypermodels
import deepof.model_utils
import json
import numpy as np
import os
import pickle
import tensorflow as tf
# Ignore warning with no downstream effect
......@@ -53,11 +53,11 @@ def load_treatments(train_path):
with open(
os.path.join(
train_path,
[i for i in os.listdir(train_path) if i.endswith(".pkl")][0],
[i for i in os.listdir(train_path) if i.endswith(".json")][0],
),
"rb",
"r",
) as handle:
treatment_dict = pickle.load(handle)
treatment_dict = json.load(handle)
except IndexError:
treatment_dict = None
......
{"units_conv": 256, "units_lstm": 256, "units_dense2": 64, "dropout_rate": 0.25, "encoding": 16, "learning_rate": 0.001}
\ No newline at end of file
......@@ -22,7 +22,7 @@ import tensorflow as tf
def test_load_treatments():
assert deepof.train_utils.load_treatments(".") is None
assert deepof.train_utils.load_treatments("tests") is None
assert isinstance(
deepof.train_utils.load_treatments(
os.path.join("tests", "test_examples", "test_single_topview", "Others")
......
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