Spaces:
Build error
Build error
Commit
·
ef59fe2
1
Parent(s):
53aa3a4
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,18 +19,23 @@ X = pd.DataFrame([symptoms_dict], columns=column_list)
|
|
| 19 |
st.write('Generated DataFrame:')
|
| 20 |
st.write(X)
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
|
| 36 |
|
|
|
|
| 19 |
st.write('Generated DataFrame:')
|
| 20 |
st.write(X)
|
| 21 |
|
| 22 |
+
if st.button("Submit"):
|
| 23 |
+
# Unpickle classifier
|
| 24 |
+
clf = joblib.load("self_diagnose_model.pkl")
|
| 25 |
+
|
| 26 |
+
# Get prediction
|
| 27 |
+
prediction = clf.predict(X)[0]
|
| 28 |
+
|
| 29 |
+
st.text("Predicted Disease:", prediction)
|
| 30 |
+
st.text("Confidence Scores (Probabilities for Each Class):")
|
| 31 |
+
st.write(confidence_scores)
|
| 32 |
+
|
| 33 |
+
# You can also display the top N predicted classes with their probabilities
|
| 34 |
+
top_n = 5 # Change this value to display more or fewer top classes
|
| 35 |
+
top_n_classes = np.argsort(-confidence_scores)[:top_n]
|
| 36 |
+
st.text("Top {} Predicted Diseases:".format(top_n))
|
| 37 |
+
for i, class_idx in enumerate(top_n_classes):
|
| 38 |
+
st.text(f"{clf.classes_[class_idx]}: {confidence_scores[class_idx]:.2f}")
|
| 39 |
|
| 40 |
|
| 41 |
|