i am trying to build flask api to deploy model but get error
FileNotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for ram://89506590-ec42-44a9-b67c-3ee4cc8e884e/variables/variables You may be trying to load on a different device from the computational device. Consider setting the experimental_io_deviceoption intf.saved_model.LoadOptions to the io_device such as '/job:localhost'.
here is my code
@app.route('/predict_Ecg' , methods = ['GET'])
def predict():
ECG_model = pickle.load(open("./ECG_Model.pckl", 'rb'))
# ECG_model = tf.keras.models.load_model('ECG97_Model.h5')
# ECG_model = pickle.load(open(("/content/drive/My Drive/Colab Notebooks//ECG97_Model.pckl") , "rb"))
signal = pd.read_csv('test.txt' , delimiter='\t')
signal = signal_preprocessing(signal)
signal = np.array(signal)
signal = signal.reshape(1 , -1)
prediction = ECG_model.predict(signal)
prediction = np.array(prediction)
prediction = prediction.ravel()
max_pred = max(prediction)
if max_pred == prediction[0]:
return jsonify({'prediction':'normal', 'date': datetime.now()})
elif max_pred == prediction[1]:
prediction = jsonify({'prediction':'Supra-ventricular premature', 'date': datetime.now()})
elif max_pred == prediction[2]:
prediction = jsonify({'prediction':'Premature ventricular contraction', 'date': datetime.now()})
elif max_pred == prediction[3]:
prediction = jsonify({'prediction':'Fusion of ventricular and normal', 'date': datetime.now()})
elif max_pred == prediction[4]:
prediction = jsonify({'prediction':'Unclassifiable beat', 'date': datetime.now()})
return prediction