Fix Python error due to Python version
This commit is contained in:
parent
e096d7ecf7
commit
72e501dab8
@ -1,13 +1,16 @@
|
|||||||
|
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|
||||||
tf.logging.set_verbosity( tf.logging.ERROR )
|
tf.compat.v1.logging.set_verbosity( tf.compat.v1.logging.ERROR )
|
||||||
|
|
||||||
keras_model_path = input( "Enter Keras model file path > " )
|
keras_model_path = input( "Enter Keras model file path > " )
|
||||||
|
|
||||||
converter = tf.lite.TFLiteConverter.from_keras_model_file( keras_model_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
|
converter.post_training_quantize = True
|
||||||
tflite_buffer = converter.convert()
|
tflite_buffer = converter.convert()
|
||||||
open( 'android/model.tflite' , 'wb' ).write( tflite_buffer )
|
open( 'android/model.tflite' , 'wb' ).write( tflite_buffer )
|
||||||
|
|
||||||
print( 'TFLite model created.')
|
print( 'TFLite model created.')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user