Utilizing predictions from ML
At this point, everything is ready. Now, to be able to perform predictions about Covid-19 from an X-ray image, we need to load our pretrained model (available in this chapter’s GitHub repository; the link can be found in the Technical requirements section) and use it with the uploaded picture (pre-processed according to the code we wrote in the Creating customized web apps to improve user experience section). As explained in the Understanding the benefits of pretrained ML models section, using a pretrained model is an easy and fast way to solve a problem without spending time developing an AI model by ourselves. In our specific case, we can predict the presence of Covid-19 from an image just by loading and using a model developed and made available by others.
Let’s start writing:
model = tf.keras.models.load_model("./models/Covid19_CNN_Classifier.h5")
In the preceding code, tf
is the alias of tensorflow
, and keras
is a module...