""" Run this ONCE on your local Mac to convert keras_model.h5 → model.tflite Usage: python convert_model.py """ import tensorflow as tf print("Loading keras_model.h5 ...") model = tf.keras.models.load_model("Model_old/keras_model.h5") print("Converting to TFLite ...") converter = tf.lite.TFLiteConverter.from_keras_model(model) tflite_model = converter.convert() with open("Model/model.tflite", "wb") as f: f.write(tflite_model) print(f"✅ Saved Model/model.tflite ({len(tflite_model) // 1024} KB)") print("Now upload Model/model.tflite to your HF Space.")