input: 
  def recognize_handwritten_digits() -> str:
      """Generate a code snippet for a Machine Learning model in Python that can recognize handwritten digits from 0 to 9.
      The model should use the MNIST dataset and consist of a neural network architecture with an input layer, hidden layer, and output layer.
      The model should be compiled with appropriate loss, optimizer, and metrics, and then trained on the dataset.
      
      >>> recognize_handwritten_digits()
      'Model trained with an accuracy of 98.5% on the test set.'
      """
  
output:     from tensorflow.keras.datasets import mnist
      from tensorflow.keras.models import Sequential
      from tensorflow.keras.layers import Dense, Flatten
      from tensorflow.keras.utils import to_categorical
  
      # Load the MNIST dataset
      (x_train, y_train), (x_test, y_test) = mnist.load_data()
  
      # Preprocess the data
      x_train = x_train.reshape((x_train.shape[0], 28 * 28)).astype('float32') / 255
      x_test = x_test.reshape((x_test.shape[0], 28 * 28)).astype('float32') / 255
      y_train = to_categorical(y_train, 10)
      y_test = to_categorical(y_test, 10)
  
      # Build the model
      model = Sequential([
          Flatten(input_shape=(28 * 28,)),
          Dense(128, activation='relu'),
          Dense(64, activation='relu'),
          Dense(10, activation='softmax')
      ])
  
      # Compile the model
      model.compile(optimizer='adam', loss='categorical_crossentropy', metrics=['accuracy'])
  
      # Train the model
      model.fit(x_train, y_train, epochs=10, batch_size=32, validation_split=0.2)
  
      # Evaluate the model
      _, accuracy = model.evaluate(x_test, y_test)
  
      return f'Model trained with an accuracy of {accuracy * 100:.1f}% on the test set.'