application_vnd.jupyter.stderr_output_2.png text_plain_output_1.png image_output_1.png
import numpy as np

import tensorflow as tf

np.random.seed(4)
tf.set_random_seed(13)

mp = '.\\mnist_model.h5'
model.save(mp)

unknown = np.zeros(shape=(28, 28), dtype=np.float32)
for row in range(5, 23):
    unknown[row][9] = 180
for rc in range(9, 19):
    unknown[rc][rc] = 250
unknown = unknown.reshape(1, 28, 28, 1)
predicted = model.predict(unknown)

str = ['zero', 'um', 'dois', 'tres', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove']
index = np.argmax(predicted[0])
digit = str[index]
print(digit)