Simple neural network coding for tic-tac-toe

I drafted a simple neural network coding for tic-tac-toe using some online references.

However, I am having some problem with neural network input dimension error.

I have solved the above error for the NN training code for tic-tac-toe

Now, how to do test/inference ?

The inference coding gave out repeated wrong results, it seems like the model output trained by the training code is wrong. Any idea why ?

now I have test accuracy of 90% on the trained NN model

But why the inference coding (Play.py) failed so badly ?