Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,12 @@ model = tf.keras.models.load_model('model.hdf5')
|
|
| 9 |
LABELS = ['NORMAL', 'TUBERCULOSIS', 'PNEUMONIA', 'COVID19']
|
| 10 |
|
| 11 |
def predict_input_image(img):
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
print(img_4d.min())
|
| 14 |
print(img_4d.max())
|
| 15 |
prediction=model.predict(img_4d)[0]
|
|
|
|
| 9 |
LABELS = ['NORMAL', 'TUBERCULOSIS', 'PNEUMONIA', 'COVID19']
|
| 10 |
|
| 11 |
def predict_input_image(img):
|
| 12 |
+
try:
|
| 13 |
+
img = Image.open(BytesIO(base64.b64decode(img)))
|
| 14 |
+
img = np.array(img)
|
| 15 |
+
except:
|
| 16 |
+
pass
|
| 17 |
+
img_4d=img.reshape(-1,128,128,3)/img.max()
|
| 18 |
print(img_4d.min())
|
| 19 |
print(img_4d.max())
|
| 20 |
prediction=model.predict(img_4d)[0]
|