5def run_tflite(model, input_path, output_path=''):
6 input = read_input(input_path)
7
8 interpreter = tf.contrib.lite.Interpreter(model_path=model)
9 interpreter.allocate_tensors()
10
11 input_details = interpreter.get_input_details()
12 output_details = interpreter.get_output_details()
13 input_data = input
14 interpreter.set_tensor(input_details[0]['index'], input_data)
15
16 interpreter.invoke()
17 output_data = interpreter.get_tensor(output_details[0]['index'])
18 print(output_data)
19 save_result(output_path, output_data)
20
21