Update app.py
Browse files
app.py
CHANGED
|
@@ -73,8 +73,23 @@ model.fc = nn.Linear(num_of_features, num_of_classes)
|
|
| 73 |
model.load_state_dict(torch.load('resnet18_model (1).pth', map_location=torch.device('cpu')))
|
| 74 |
model.eval()
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
# Image upload
|
| 77 |
-
uploaded_img = st.file_uploader("
|
| 78 |
if st.button("Submit"):
|
| 79 |
if uploaded_img is not None:
|
| 80 |
# Display uploaded image in a smaller size
|
|
@@ -87,7 +102,7 @@ if st.button("Submit"):
|
|
| 87 |
transforms.ToTensor(),
|
| 88 |
transforms.Normalize(mean=[0.1776, 0.1776, 0.1776], std=[0.1735, 0.1735, 0.1735])
|
| 89 |
])
|
| 90 |
-
|
| 91 |
# Apply transformations
|
| 92 |
transformed_img = sample_transform(image).unsqueeze(0)
|
| 93 |
|
|
|
|
| 73 |
model.load_state_dict(torch.load('resnet18_model (1).pth', map_location=torch.device('cpu')))
|
| 74 |
model.eval()
|
| 75 |
|
| 76 |
+
st.markdown(
|
| 77 |
+
"""
|
| 78 |
+
<div style='
|
| 79 |
+
font-weight: bold;
|
| 80 |
+
font-size: 20px;
|
| 81 |
+
color: #FF69B4;
|
| 82 |
+
margin-bottom: 10px;
|
| 83 |
+
text-align: center;
|
| 84 |
+
text-shadow: 1px 1px #ccc;
|
| 85 |
+
'>
|
| 86 |
+
📤 Upload an Image
|
| 87 |
+
</div>
|
| 88 |
+
""",
|
| 89 |
+
unsafe_allow_html=True
|
| 90 |
+
)
|
| 91 |
# Image upload
|
| 92 |
+
uploaded_img = st.file_uploader("", type=["jpg", "jpeg", "png"])
|
| 93 |
if st.button("Submit"):
|
| 94 |
if uploaded_img is not None:
|
| 95 |
# Display uploaded image in a smaller size
|
|
|
|
| 102 |
transforms.ToTensor(),
|
| 103 |
transforms.Normalize(mean=[0.1776, 0.1776, 0.1776], std=[0.1735, 0.1735, 0.1735])
|
| 104 |
])
|
| 105 |
+
|
| 106 |
# Apply transformations
|
| 107 |
transformed_img = sample_transform(image).unsqueeze(0)
|
| 108 |
|