Update app.py
Browse files
app.py
CHANGED
@@ -41,17 +41,20 @@ st.markdown(
|
|
41 |
"This app classifies bacterial morphology into **Cocci**, **Bacilli**, or **Spirilla** using a fine-tuned PyTorch model."
|
42 |
)
|
43 |
|
44 |
-
#
|
45 |
st.subheader("Example Images")
|
46 |
-
|
47 |
-
"https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/resolve/main/img%20290.jpg",
|
48 |
"https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/resolve/main/img%20565.jpg",
|
49 |
"https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/resolve/main/img%208.jpg"
|
50 |
]
|
51 |
|
52 |
-
for img_path in
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
55 |
|
56 |
# File Upload
|
57 |
uploaded_file = st.file_uploader("Upload a bacterial image for classification:", type=["jpg", "jpeg", "png"])
|
|
|
41 |
"This app classifies bacterial morphology into **Cocci**, **Bacilli**, or **Spirilla** using a fine-tuned PyTorch model."
|
42 |
)
|
43 |
|
44 |
+
# Display example images from local files
|
45 |
st.subheader("Example Images")
|
46 |
+
example_image_paths = [
|
47 |
+
"https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/resolve/main/img%20290.jpg",
|
48 |
"https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/resolve/main/img%20565.jpg",
|
49 |
"https://huggingface.co/datasets/yolac/BacterialMorphologyClassification/resolve/main/img%208.jpg"
|
50 |
]
|
51 |
|
52 |
+
for img_path in example_image_paths:
|
53 |
+
try:
|
54 |
+
img = Image.open(img_path).convert("RGB")
|
55 |
+
st.image(img, caption=f"Example Image: {img_path}", use_column_width=True)
|
56 |
+
except FileNotFoundError:
|
57 |
+
st.error(f"Example image {img_path} not found. Please ensure the image exists in the app directory.")
|
58 |
|
59 |
# File Upload
|
60 |
uploaded_file = st.file_uploader("Upload a bacterial image for classification:", type=["jpg", "jpeg", "png"])
|