docstr: /models/{name}
  
  schema:
  {
    "modelParams": dict containing model parameters
    "predictedFieldName": str
  }
  
  returns:
  {"success":name}
docstr_tok: ["\/models\/","{","name","}","schema",":","{","``","modelParams","''",":","dict","containing","model","parameters","``","predictedFieldName","''",":","str","}","returns",":","{","``","success","''",":","name","}"]
code: def POST(self, name):
      """
      /models/{name}
  
      schema:
      {
        "modelParams": dict containing model parameters
        "predictedFieldName": str
      }
  
      returns:
      {"success":name}
      """
      global g_models
  
      data = json.loads(web.data())
      modelParams = data["modelParams"]
      predictedFieldName = data["predictedFieldName"]
  
      if name in g_models.keys():
          raise web.badrequest(
              "Model with name <%s> already exists" % name
          )
  
      model = ModelFactory.create(modelParams)
      model.enableInference({"predictedField": predictedFieldName})
      g_models[name] = model
  
      return json.dumps({"success": name})
  
file_path: nupic-legacy/src/nupic/simple_server.py
imports: import os
  import sys
  import datetime
  import json
  import web
  from nupic.frameworks.opf.model_factory import ModelFactory
label_desc: Use image node_id 2 for calling the ModelHandler obj's underlying member method code with example usage: obj.POST(name) and returns: json