From 9e67c33083864e704bd5def25f3f063b610d4d85 Mon Sep 17 00:00:00 2001 From: Nabeel Date: Mon, 13 Jan 2020 10:31:37 +1100 Subject: [PATCH] Docker file for v.6.3 --- core/_machine_learning.py | 27 --------------------------- docker/Dockerfile v.6.3 | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 27 deletions(-) create mode 100644 docker/Dockerfile v.6.3 diff --git a/core/_machine_learning.py b/core/_machine_learning.py index e41870b..98e1ce0 100644 --- a/core/_machine_learning.py +++ b/core/_machine_learning.py @@ -96,24 +96,6 @@ def save(self, name, path, overwrite=True, compress=3, locked_timeout=2): # The Keras estimator is excluded from the model saved to the joblib file self.pipe.named_steps['estimator'].model = None - #self.pipe.steps[self.estimation_step] = ('estimator', None) - - # Deconstruct the pipeline for pickling - #self.pipe_steps = [] - #for step in self.pipe.steps: - # if step[0] != 'estimator': - # self.pipe_steps.append(step) - # else: - # self.pipe_steps.append(('estimator', None)) - - # Delete the pipe to avoid pickling errors due to tensorflow remnants - #del self.pipe - - # Avoid pickling errors due to tensorflow session remnants - #sess = kerasbackend.get_session() - #kerasbackend.clear_session() - #sess.close() - #gc.collect() except AttributeError: pass @@ -146,15 +128,6 @@ def load(self, name, path): # https://stackoverflow.com/questions/40785224/tensorflow-cannot-interpret-feed-dict-key-as-tensor kerasbackend.clear_session() - # Re-create the pipeline - #self.pipe = Pipeline(self.pipe_steps) - - # Re-create the scikit-learn wrapper for Keras - #if self.estimator_type == "classifier": - # self.pipe.steps[self.estimation_step] = ('estimator', KerasClassifierForQlik(**self.estimator_kwargs)) - #else: - # self.pipe.steps[self.estimation_step] = ('estimator', KerasRegressorForQlik(**self.estimator_kwargs)) - # Load the keras model architecture and weights from disk keras_model = keras.models.load_model(path + name + '.h5') keras_model._make_predict_function() diff --git a/docker/Dockerfile v.6.3 b/docker/Dockerfile v.6.3 new file mode 100644 index 0000000..d5c0ea3 --- /dev/null +++ b/docker/Dockerfile v.6.3 @@ -0,0 +1,14 @@ +# Use the previous version of qlik-py-tools as a parent image +FROM nabeeloz/qlik-py-tools:6.2 + +# Set the working directory to /qlik-py-tools/core +WORKDIR /qlik-py-tools/core + +# Copy all files from the core subdirectory into the container +COPY ./core/* /qlik-py-tools/core/ + +# Make ports 80 and 50055 available to the world outside this container +EXPOSE 80 50055 + +# Run __main__.py when the container launches +CMD ["python", "__main__.py"] \ No newline at end of file