(self, inputs)
Translate `inputs`
           We keep the same format as the Lua version i.e.
             [{"id": model_id, "src": "sequence to translate"},{ ...}]

           We use inputs[0]["id"] as the model id
Translate `inputs`
           We keep the same format as the Lua version i.e.
             [{"id": model_id, "src": "sequence to translate"},{ ...}]
Translate inputs We keep the same format as the Lua version i . e . [ { id : model_id src : sequence to translate } { ... } ]
def run(self, inputs):
        """Translate `inputs`
           We keep the same format as the Lua version i.e.
             [{"id": model_id, "src": "sequence to translate"},{ ...}]

           We use inputs[0]["id"] as the model id
        """
        model_id = inputs[0].get("id", 0)
        if model_id in self.models and self.models[model_id] is not None:
            return self.models[model_id].run(inputs)
        else:
            print("Error No such model '%s'" % str(model_id))
            raise ServerModelError("No such model '%s'" % str(model_id))
def run ( self , inputs ) : model_id = inputs [ 0 ] . get ( "id" , 0 ) if model_id in self . models and self . models [ model_id ] is not None : return self . models [ model_id ] . run ( inputs ) else : print ( "Error No such model '%s'" % str ( model_id ) ) raise ServerModelError ( "No such model '%s'" % str ( model_id ) )