def _do_spec(self): spec = _get_next_spec() if spec: data = common.encode(spec) self.send_response(200) self.send_header("Content-type", "text/plain") self.send_header("Content-Length", str(len(data))) self.end_headers() self.wfile.write(data) else: self.send_response(400) self.end_headers()
def compute(spec_data): spec = common.decode(spec_data) result = models.compute_probabilistic(spec) return common.encode(result)