parameters: (input_df)
return_statement: return json_pred
docstring: Executes prediction
      
      Arguments:
          input_df {string} -- base64 enconded image
      
      Returns:
          string -- json parsed classification output (label/probability array)
docstring_summary: Executes prediction
      
      Arguments:
          input_df {string} -- base64 enconded image
      
      Returns:
          string -- json parsed classification output (label/probability array)
docstring_tokens: Executes prediction Arguments : input_df { string } -- base64 enconded image Returns : string -- json parsed classification output ( label / probability array )
function: def run(input_df):
      """Executes prediction
      
      Arguments:
          input_df {string} -- base64 enconded image
      
      Returns:
          string -- json parsed classification output (label/probability array)
      """    
      import pandas
  
      # Generates random image name
      uploadedImage = ''.join([random.choice(string.ascii_letters + string.digits) for n in range(16)]) + ".jpg"
      
      inputs_dc.collect(str(input_df))
      
      # Save file to disk and load (applying keras image transformations as applied in training)
      pil_img = base64ToPilImg(input_df["base64image"])
      pil_img.save(uploadedImage, "JPEG")    
      image = load_image(uploadedImage)
  
      # Classification
      pred = model.eval(image)
      prediction_dc.collect(pred)
  
      os.remove(uploadedImage)
  
      # Format json output classification
      df = {'probability':pred[0], 'label': labels}
      df = pandas.DataFrame(df)    
  
      json_pred = df.to_json(orient='records')
      print("result:", json_pred)
      return json_pred
function_tokens: def run ( input_df ) : import pandas # Generates random image name uploadedImage = '' . join ( [ random . choice ( string . ascii_letters + string . digits ) for n in range ( 16 ) ] ) + ".jpg" inputs_dc . collect ( str ( input_df ) ) # Save file to disk and load (applying keras image transformations as applied in training) pil_img = base64ToPilImg ( input_df [ "base64image" ] ) pil_img . save ( uploadedImage , "JPEG" ) image = load_image ( uploadedImage ) # Classification pred = model . eval ( image ) prediction_dc . collect ( pred ) os . remove ( uploadedImage ) # Format json output classification df = { 'probability' : pred [ 0 ] , 'label' : labels } df = pandas . DataFrame ( df ) json_pred = df . to_json ( orient = 'records' ) print ( "result:" , json_pred ) return json_pred