original_docstring: 
      Do an inference on a single batch of data. In this sample server, we take
      data as CSV, convert it to a pandas data frame for internal use and then
      convert the predictions back to CSV (which really just means one prediction
      per line, since there's a single column.
      
docstring: Do an inference on a single batch of data. In this sample server, we take
  data as CSV, convert it to a pandas data frame for internal use and then
  convert the predictions back to CSV (which really just means one prediction
  per line, since there's a single column.
docstring_tokens: Do an inference on a single batch of data . In this sample server we take data as CSV convert it to a pandas data frame for internal use and then convert the predictions back to CSV ( which really just means one prediction per line since there ' s a single column .
code: def transformation():
      """
      Do an inference on a single batch of data. In this sample server, we take
      data as CSV, convert it to a pandas data frame for internal use and then
      convert the predictions back to CSV (which really just means one prediction
      per line, since there's a single column.
      """
      data = None
  
      # Convert from CSV to pandas
      if flask.request.content_type == 'text/csv':
          data = flask.request.data.decode('utf-8')
          f = StringIO(data)
          data = pd.read_csv(f)            
      else:
          return flask.Response(
              response='This predictor only supports CSV data',
              status=415,
              mimetype='text/plain')
  
      print('Invoked with {} records'.format(data.shape[0]))
  
      # Do the prediction
      print("data=%s" % data)
      predictions = ScoringService.predict(data)
      print("predictions=%s" % predictions)
  
      # Convert from numpy back to CSV
      
      result = pd.DataFrame(predictions).to_csv(header=False, index=False)
      print("result=%s" % result)
      #result = out.getvalue()
  
      return flask.Response(response=result, status=200, mimetype='text/csv')
code_tokens: def transformation ( ) : data = None if flask . request . content_type == 'text/csv' : data = flask . request . data . decode ( 'utf-8' ) f = StringIO ( data ) data = pd . read_csv ( f ) else : return flask . Response ( response = 'This predictor only supports CSV data' , status = 415 , mimetype = 'text/plain' ) print ( 'Invoked with {} records' . format ( data . shape [ 0 ] ) ) print ( "data=%s" % data ) predictions = ScoringService . predict ( data ) print ( "predictions=%s" % predictions ) result = pd . DataFrame ( predictions ) . to_csv ( header = False , index = False ) print ( "result=%s" % result ) return flask . Response ( response = result , status = 200 , mimetype = 'text/csv' )
short_docstring: Do an inference on a single batch of data.
short_docstring_tokens: Do an inference on a single batch of data .
comment: """
      Do an inference on a single batch of data. In this sample server, we take
      data as CSV, convert it to a pandas data frame for internal use and then
      convert the predictions back to CSV (which really just means one prediction
      per line, since there's a single column.
      """$SEP$# Convert from CSV to pandas$SEP$# Do the prediction$SEP$# Convert from numpy back to CSV$SEP$#result = out.getvalue()