Update app.py
Browse files
app.py
CHANGED
|
@@ -77,9 +77,9 @@ model.eval()
|
|
| 77 |
uploaded_img = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
| 78 |
|
| 79 |
if uploaded_img is not None:
|
| 80 |
-
# Display uploaded image
|
| 81 |
image = Image.open(uploaded_img)
|
| 82 |
-
st.image(image, caption="Uploaded Image",
|
| 83 |
|
| 84 |
# Image transformations
|
| 85 |
sample_transform = transforms.Compose([
|
|
@@ -94,6 +94,13 @@ if uploaded_img is not None:
|
|
| 94 |
# Model inference
|
| 95 |
with torch.no_grad():
|
| 96 |
pred = model(transformed_img).argmax(dim=1).item()
|
| 97 |
-
|
| 98 |
-
#
|
| 99 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
uploaded_img = st.file_uploader("Upload an image", type=["jpg", "jpeg", "png"])
|
| 78 |
|
| 79 |
if uploaded_img is not None:
|
| 80 |
+
# Display uploaded image in a smaller size
|
| 81 |
image = Image.open(uploaded_img)
|
| 82 |
+
st.image(image, caption="Uploaded Image", width=200) # Set width to reduce image size
|
| 83 |
|
| 84 |
# Image transformations
|
| 85 |
sample_transform = transforms.Compose([
|
|
|
|
| 94 |
# Model inference
|
| 95 |
with torch.no_grad():
|
| 96 |
pred = model(transformed_img).argmax(dim=1).item()
|
| 97 |
+
|
| 98 |
+
# Stylish output box
|
| 99 |
+
st.markdown(
|
| 100 |
+
f"""
|
| 101 |
+
<div class="output-container">
|
| 102 |
+
🧠 <strong>Predicted Class:</strong> {class_names[pred]}
|
| 103 |
+
</div>
|
| 104 |
+
""",
|
| 105 |
+
unsafe_allow_html=True
|
| 106 |
+
)
|