Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,11 +33,14 @@ def predict(image):
|
|
| 33 |
|
| 34 |
# Perform inference
|
| 35 |
predictions = model.predict(input_tensor)
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
# Extract the predicted class label with the highest probability
|
| 38 |
-
prediction = np.argmax(predictions[0])
|
| 39 |
|
| 40 |
-
if(
|
| 41 |
return "Pneumonia"
|
| 42 |
else:
|
| 43 |
return "Normal"
|
|
|
|
| 33 |
|
| 34 |
# Perform inference
|
| 35 |
predictions = model.predict(input_tensor)
|
| 36 |
+
|
| 37 |
+
predicted_probabilities = np.squeeze(predictions)
|
| 38 |
+
predicted_class = np.argmax(predicted_probabilities)
|
| 39 |
|
| 40 |
# Extract the predicted class label with the highest probability
|
| 41 |
+
# prediction = np.argmax(predictions[0])
|
| 42 |
|
| 43 |
+
if(predicted_class > 0.5):
|
| 44 |
return "Pneumonia"
|
| 45 |
else:
|
| 46 |
return "Normal"
|