(input)
return list(map(lambda x: int(x), pr))
Reshape numpy array and predict new data.
Reshape numpy array and predict new data.
Reshape numpy array and predict new data .
def predict(input):
    """Reshape numpy array and predict new data."""
    pf = process_input(input)
    # Reshape data to be [samples][pixels][width][height]
    pf = pf.reshape(pf.shape[0], 1, 28, 28).astype('float32')
    # Normalize inputs from 0-255 to 0-1
    pf = pf / 255
    pr = classifier.predict_classes(pf)
    # Cast the numpy array predicted values as a list.
    return list(map(lambda x: int(x), pr))
def predict ( input ) : pf = process_input ( input ) # Reshape data to be [samples][pixels][width][height] pf = pf . reshape ( pf . shape [ 0 ] , 1 , 28 , 28 ) . astype ( 'float32' ) # Normalize inputs from 0-255 to 0-1 pf = pf / 255 pr = classifier . predict_classes ( pf ) # Cast the numpy array predicted values as a list. return list ( map ( lambda x : int ( x ) , pr ) )