Update app.py
Browse files
app.py
CHANGED
|
@@ -29,19 +29,8 @@ def classify_mammogram(img):
|
|
| 29 |
return f"Predicted Class: {predicted_label}\nClassification: {classification}\nConfidence: {confidence:.2f}"
|
| 30 |
|
| 31 |
# Streamlit app
|
| 32 |
-
st.title("
|
| 33 |
st.write("Upload an image of a mammogram, and the model will predict whether it is benign or malignant.")
|
| 34 |
-
|
| 35 |
-
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
| 36 |
-
|
| 37 |
-
if uploaded_file is not None:
|
| 38 |
-
image = Image.open(uploaded_file)
|
| 39 |
-
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
| 40 |
-
st.write("Classifying...")
|
| 41 |
-
|
| 42 |
-
#classification_result = classify_mammogram(image)
|
| 43 |
-
st.write(classification_result)
|
| 44 |
-
|
| 45 |
st.write(
|
| 46 |
"""
|
| 47 |
<div style='display: flex; justify-content: space-between;'>
|
|
@@ -65,3 +54,55 @@ st.write(
|
|
| 65 |
""",
|
| 66 |
unsafe_allow_html=True
|
| 67 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
return f"Predicted Class: {predicted_label}\nClassification: {classification}\nConfidence: {confidence:.2f}"
|
| 30 |
|
| 31 |
# Streamlit app
|
| 32 |
+
st.title("Breast Cancer Detection App")
|
| 33 |
st.write("Upload an image of a mammogram, and the model will predict whether it is benign or malignant.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
st.write(
|
| 35 |
"""
|
| 36 |
<div style='display: flex; justify-content: space-between;'>
|
|
|
|
| 54 |
""",
|
| 55 |
unsafe_allow_html=True
|
| 56 |
)
|
| 57 |
+
|
| 58 |
+
uploaded_file = st.file_uploader("Choose an image...", type=["jpg", "jpeg", "png"])
|
| 59 |
+
|
| 60 |
+
if uploaded_file is not None:
|
| 61 |
+
image = Image.open(uploaded_file)
|
| 62 |
+
st.image(image, caption='Uploaded Image.', use_column_width=True)
|
| 63 |
+
st.write("Classifying...")
|
| 64 |
+
|
| 65 |
+
classification_result = classify_mammogram(image)
|
| 66 |
+
st.write(classification_result)
|
| 67 |
+
|
| 68 |
+
# Educational content
|
| 69 |
+
st.markdown("### Learn More About Breast Cancer")
|
| 70 |
+
st.markdown("""
|
| 71 |
+
- [Breast Cancer Overview](https://www.who.int/news-room/fact-sheets/detail/breast-cancer)
|
| 72 |
+
- [Preventing Breast Cancer](https://www.cancer.gov/types/breast/patient/breast-prevention-pdq)
|
| 73 |
+
""")
|
| 74 |
+
# Determine the current Streamlit theme (light or dark)
|
| 75 |
+
theme = st.get_option("theme.base")
|
| 76 |
+
|
| 77 |
+
# Define button styling based on theme
|
| 78 |
+
if theme == "light":
|
| 79 |
+
button_bg_color = "#2c2e35"
|
| 80 |
+
button_border_color = "1px solid black"
|
| 81 |
+
button_text_color = "black"
|
| 82 |
+
else:
|
| 83 |
+
button_bg_color = "#2c2e35"
|
| 84 |
+
button_border_color = "1px solid #fff"
|
| 85 |
+
button_text_color = "#fff"
|
| 86 |
+
|
| 87 |
+
# Rounded button-like element with dynamic styling
|
| 88 |
+
st.markdown(f"""
|
| 89 |
+
<style>
|
| 90 |
+
.rounded-button {{
|
| 91 |
+
display: inline-block;
|
| 92 |
+
padding: 7px 15px;
|
| 93 |
+
font-size: 16px;
|
| 94 |
+
color: {button_text_color};
|
| 95 |
+
background-color: {button_bg_color};
|
| 96 |
+
border: {button_border_color};
|
| 97 |
+
border-radius: 7px;
|
| 98 |
+
text-align: center;
|
| 99 |
+
text-decoration: none;
|
| 100 |
+
cursor: default;
|
| 101 |
+
}}
|
| 102 |
+
</style>
|
| 103 |
+
<div style="text-align: center;">
|
| 104 |
+
<div class="rounded-button">
|
| 105 |
+
Created by: Johnson Ameyaw
|
| 106 |
+
</div>
|
| 107 |
+
</div>
|
| 108 |
+
""", unsafe_allow_html=True)
|