using tempfile for serialization of the model file