Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +7 -6
- requirements.txt +0 -1
app.py
CHANGED
@@ -36,19 +36,19 @@ def load_pickle_model(model_path):
|
|
36 |
models_info = {
|
37 |
"ANN Model": {
|
38 |
"path": "ann_model.pkl",
|
39 |
-
"accuracy": 0
|
40 |
},
|
41 |
"Decision Tree": {
|
42 |
"path": "decision_tree_classifier_model.pkl",
|
43 |
-
"accuracy":
|
44 |
},
|
45 |
"Logistic Regression": {
|
46 |
"path": "logistic_regression_model.pkl",
|
47 |
-
"accuracy":
|
48 |
},
|
49 |
"CNN Model": {
|
50 |
"path": "best_model_.keras",
|
51 |
-
"accuracy": 0
|
52 |
}
|
53 |
}
|
54 |
|
@@ -61,7 +61,7 @@ model_name = st.selectbox("Choose a model:", list(models_info.keys()))
|
|
61 |
|
62 |
# Display selected model accuracy
|
63 |
st.write(f"Selected Model: {model_name}")
|
64 |
-
st.write(f"Validation Accuracy: {models_info[model_name]['accuracy']
|
65 |
|
66 |
# Load the selected model
|
67 |
if model_name == "CNN Model":
|
@@ -91,4 +91,5 @@ if uploaded_file is not None:
|
|
91 |
prediction = model.predict(preprocessed_img)
|
92 |
prediction_label = "Pneumonia" if prediction[0] > 0.5 else "Normal"
|
93 |
|
94 |
-
|
|
|
|
36 |
models_info = {
|
37 |
"ANN Model": {
|
38 |
"path": "ann_model.pkl",
|
39 |
+
"accuracy": 71.0 # Use decimal percentage
|
40 |
},
|
41 |
"Decision Tree": {
|
42 |
"path": "decision_tree_classifier_model.pkl",
|
43 |
+
"accuracy": 71.96
|
44 |
},
|
45 |
"Logistic Regression": {
|
46 |
"path": "logistic_regression_model.pkl",
|
47 |
+
"accuracy": 71.47
|
48 |
},
|
49 |
"CNN Model": {
|
50 |
"path": "best_model_.keras",
|
51 |
+
"accuracy": 90.0
|
52 |
}
|
53 |
}
|
54 |
|
|
|
61 |
|
62 |
# Display selected model accuracy
|
63 |
st.write(f"Selected Model: {model_name}")
|
64 |
+
st.write(f"Validation Accuracy: {models_info[model_name]['accuracy']:.2f}%")
|
65 |
|
66 |
# Load the selected model
|
67 |
if model_name == "CNN Model":
|
|
|
91 |
prediction = model.predict(preprocessed_img)
|
92 |
prediction_label = "Pneumonia" if prediction[0] > 0.5 else "Normal"
|
93 |
|
94 |
+
# Highlight the prediction
|
95 |
+
st.markdown(f"**Prediction:** <span style='color: {'red' if prediction_label == 'Pneumonia' else 'green'}; font-size: 24px;'>{prediction_label}</span> (Model: {model_name})", unsafe_allow_html=True)
|
requirements.txt
CHANGED
@@ -7,4 +7,3 @@ scipy
|
|
7 |
scikit-learn
|
8 |
keras_tuner
|
9 |
scikeras
|
10 |
-
lime
|
|
|
7 |
scikit-learn
|
8 |
keras_tuner
|
9 |
scikeras
|
|