code: def start_flask_service(self):
          
          app = Flask(__name__)
          self.app = app
  
          @app.route('/')
          def home():
              return 'Elephas'
  
          @app.route('/parameters', methods=['GET'])
          def handle_get_parameters():
              if self.mode == 'asynchronous':
                  self.lock.acquire_read()
              self.pickled_weights = pickle.dumps(self.weights, -1)
              pickled_weights = self.pickled_weights
              if self.mode == 'asynchronous':
                  self.lock.release()
              return pickled_weights
  
          @app.route('/update', methods=['POST'])
          def handle_update_parameters():
              delta = pickle.loads(request.data)
              if self.mode == 'asynchronous':
                  self.lock.acquire_write()
  
              if not self.master_network.built:
                  self.master_network.build()
  
              # Just apply the gradient
              weights_before = self.weights
              self.weights = subtract_params(weights_before, delta)
  
              if self.mode == 'asynchronous':
                  self.lock.release()
              return 'Update done'
  
          master_url = determine_master(self.port)
          host = master_url.split(':')[0]
          self.app.run(host=host, debug=self.debug, port=self.port,
                       threaded=self.threaded, use_reloader=self.use_reloader)
docs: Define Flask parameter server service.
  
          This HTTP server can do two things: get the current model
          parameters and update model parameters. After registering
          the `parameters` and `update` routes, the service will
          get started.