Upload app.py
Browse files
app.py
CHANGED
|
@@ -61,26 +61,29 @@ st.markdown("""
|
|
| 61 |
.upload-section {
|
| 62 |
background: linear-gradient(135deg, #a8e6cf 0%, #74b9ff 100%);
|
| 63 |
color: white;
|
| 64 |
-
padding:
|
| 65 |
border-radius: 15px;
|
| 66 |
text-align: center;
|
| 67 |
margin-bottom: 20px;
|
| 68 |
box-shadow: 0 6px 20px rgba(168, 230, 207, 0.3);
|
| 69 |
-
height:
|
| 70 |
display: flex;
|
| 71 |
flex-direction: column;
|
| 72 |
justify-content: center;
|
|
|
|
| 73 |
}
|
| 74 |
|
| 75 |
.upload-section h3 {
|
| 76 |
font-size: 1.3rem;
|
| 77 |
-
margin: 0 0
|
|
|
|
| 78 |
}
|
| 79 |
|
| 80 |
.upload-section p {
|
| 81 |
-
font-size: 0.
|
| 82 |
margin: 0;
|
| 83 |
opacity: 0.9;
|
|
|
|
| 84 |
}
|
| 85 |
|
| 86 |
.result-fire {
|
|
@@ -205,6 +208,10 @@ st.markdown("""
|
|
| 205 |
padding: 20px;
|
| 206 |
background: rgba(116, 185, 255, 0.05);
|
| 207 |
transition: all 0.3s ease;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 208 |
}
|
| 209 |
|
| 210 |
.stFileUploader > div > div:hover {
|
|
@@ -214,6 +221,25 @@ st.markdown("""
|
|
| 214 |
box-shadow: 0 4px 15px rgba(116, 185, 255, 0.2);
|
| 215 |
}
|
| 216 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 217 |
/* Mobile responsive adjustments */
|
| 218 |
@media (max-width: 768px) {
|
| 219 |
.main-header h1 {
|
|
@@ -225,11 +251,18 @@ st.markdown("""
|
|
| 225 |
}
|
| 226 |
|
| 227 |
.upload-section {
|
| 228 |
-
height:
|
|
|
|
| 229 |
}
|
| 230 |
|
| 231 |
.upload-section h3 {
|
| 232 |
font-size: 1.1rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 233 |
}
|
| 234 |
|
| 235 |
.result-fire h2, .result-no-fire h2 {
|
|
@@ -485,19 +518,19 @@ def main():
|
|
| 485 |
st.markdown("""
|
| 486 |
<div class="upload-section">
|
| 487 |
<h3>πΈ Fire Detection Input</h3>
|
| 488 |
-
<p>Upload an image or take a photo to detect fire or smoke
|
| 489 |
</div>
|
| 490 |
""", unsafe_allow_html=True)
|
| 491 |
|
| 492 |
# Mobile-friendly file uploader that opens native camera
|
| 493 |
st.markdown("**π± Take Photo or Upload Image**")
|
| 494 |
-
st.markdown("πΈ **On Mobile**: Tap below β Choose '
|
| 495 |
-
st.markdown("π» **On Desktop**: Click below to select image files")
|
| 496 |
|
| 497 |
uploaded_file = st.file_uploader(
|
| 498 |
-
"
|
| 499 |
type=['jpg', 'jpeg', 'png', 'bmp', 'tiff'],
|
| 500 |
-
help="π± Mobile: Tap
|
| 501 |
)
|
| 502 |
|
| 503 |
# Process the uploaded image
|
|
|
|
| 61 |
.upload-section {
|
| 62 |
background: linear-gradient(135deg, #a8e6cf 0%, #74b9ff 100%);
|
| 63 |
color: white;
|
| 64 |
+
padding: 20px 25px;
|
| 65 |
border-radius: 15px;
|
| 66 |
text-align: center;
|
| 67 |
margin-bottom: 20px;
|
| 68 |
box-shadow: 0 6px 20px rgba(168, 230, 207, 0.3);
|
| 69 |
+
height: 130px;
|
| 70 |
display: flex;
|
| 71 |
flex-direction: column;
|
| 72 |
justify-content: center;
|
| 73 |
+
line-height: 1.4;
|
| 74 |
}
|
| 75 |
|
| 76 |
.upload-section h3 {
|
| 77 |
font-size: 1.3rem;
|
| 78 |
+
margin: 0 0 8px 0;
|
| 79 |
+
font-weight: bold;
|
| 80 |
}
|
| 81 |
|
| 82 |
.upload-section p {
|
| 83 |
+
font-size: 0.95rem;
|
| 84 |
margin: 0;
|
| 85 |
opacity: 0.9;
|
| 86 |
+
line-height: 1.3;
|
| 87 |
}
|
| 88 |
|
| 89 |
.result-fire {
|
|
|
|
| 208 |
padding: 20px;
|
| 209 |
background: rgba(116, 185, 255, 0.05);
|
| 210 |
transition: all 0.3s ease;
|
| 211 |
+
min-height: 80px;
|
| 212 |
+
display: flex;
|
| 213 |
+
align-items: center;
|
| 214 |
+
justify-content: center;
|
| 215 |
}
|
| 216 |
|
| 217 |
.stFileUploader > div > div:hover {
|
|
|
|
| 221 |
box-shadow: 0 4px 15px rgba(116, 185, 255, 0.2);
|
| 222 |
}
|
| 223 |
|
| 224 |
+
/* Mobile specific styling */
|
| 225 |
+
@media (max-width: 768px) {
|
| 226 |
+
.stFileUploader > div > div {
|
| 227 |
+
min-height: 100px;
|
| 228 |
+
padding: 25px;
|
| 229 |
+
font-size: 1.1rem;
|
| 230 |
+
}
|
| 231 |
+
|
| 232 |
+
.stFileUploader button {
|
| 233 |
+
padding: 15px 25px;
|
| 234 |
+
font-size: 1.1rem;
|
| 235 |
+
border-radius: 10px;
|
| 236 |
+
background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
|
| 237 |
+
color: white;
|
| 238 |
+
border: none;
|
| 239 |
+
font-weight: bold;
|
| 240 |
+
}
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
/* Mobile responsive adjustments */
|
| 244 |
@media (max-width: 768px) {
|
| 245 |
.main-header h1 {
|
|
|
|
| 251 |
}
|
| 252 |
|
| 253 |
.upload-section {
|
| 254 |
+
height: 110px;
|
| 255 |
+
padding: 18px 20px;
|
| 256 |
}
|
| 257 |
|
| 258 |
.upload-section h3 {
|
| 259 |
font-size: 1.1rem;
|
| 260 |
+
margin: 0 0 6px 0;
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
.upload-section p {
|
| 264 |
+
font-size: 0.9rem;
|
| 265 |
+
line-height: 1.2;
|
| 266 |
}
|
| 267 |
|
| 268 |
.result-fire h2, .result-no-fire h2 {
|
|
|
|
| 518 |
st.markdown("""
|
| 519 |
<div class="upload-section">
|
| 520 |
<h3>πΈ Fire Detection Input</h3>
|
| 521 |
+
<p>Upload an image or take a photo to detect fire or smoke<br>in your data center</p>
|
| 522 |
</div>
|
| 523 |
""", unsafe_allow_html=True)
|
| 524 |
|
| 525 |
# Mobile-friendly file uploader that opens native camera
|
| 526 |
st.markdown("**π± Take Photo or Upload Image**")
|
| 527 |
+
st.markdown("πΈ **On Mobile**: Tap 'Browse files' below β Choose 'Camera' to take photo")
|
| 528 |
+
st.markdown("π» **On Desktop**: Click 'Browse files' below to select image files")
|
| 529 |
|
| 530 |
uploaded_file = st.file_uploader(
|
| 531 |
+
"πΈ Tap 'Browse files' β Camera (Mobile) | π Choose file (Desktop)",
|
| 532 |
type=['jpg', 'jpeg', 'png', 'bmp', 'tiff'],
|
| 533 |
+
help="π± Mobile: Tap 'Browse files' then select 'Camera' | π» Desktop: Click to browse files"
|
| 534 |
)
|
| 535 |
|
| 536 |
# Process the uploaded image
|