
import tensorflow as tf

tf.compat.v1.logging.set_verbosity( tf.compat.v1.logging.ERROR )

keras_model_path = input( "Enter Keras model file path > " )

keras_model = tf.keras.models.load_model(keras_model_path)
converter = tf.lite.TFLiteConverter.from_keras_model(keras_model)
#converter = tf.lite.TFLiteConverter.from_keras_model( keras_model_path )

converter.post_training_quantize = True
tflite_buffer = converter.convert()
open( 'android/model.tflite' , 'wb' ).write( tflite_buffer )

print( 'TFLite model created.')
