Upload app.py
Browse files
app.py
CHANGED
|
@@ -391,14 +391,19 @@ def main():
|
|
| 391 |
image, model, transform
|
| 392 |
)
|
| 393 |
if predicted_class is not None:
|
| 394 |
-
#
|
| 395 |
-
|
| 396 |
-
|
| 397 |
-
|
| 398 |
-
|
| 399 |
-
|
| 400 |
-
|
| 401 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
|
| 403 |
with col2:
|
| 404 |
if hasattr(st.session_state, 'prediction_results'):
|
|
|
|
| 391 |
image, model, transform
|
| 392 |
)
|
| 393 |
if predicted_class is not None:
|
| 394 |
+
# Confidence thresholding for OOD detection
|
| 395 |
+
if max(probabilities) <= 0.8:
|
| 396 |
+
st.warning("⚠️ This image does not appear to be a telecom site. Please upload a valid telecom site photo.")
|
| 397 |
+
st.session_state.prediction_results = None
|
| 398 |
+
else:
|
| 399 |
+
# Store results in session state
|
| 400 |
+
st.session_state.prediction_results = {
|
| 401 |
+
'predicted_class': predicted_class,
|
| 402 |
+
'confidence': confidence,
|
| 403 |
+
'probabilities': probabilities,
|
| 404 |
+
'analysis': analyze_site_quality(predicted_class, confidence)
|
| 405 |
+
}
|
| 406 |
+
st.success("✅ Analysis complete!")
|
| 407 |
|
| 408 |
with col2:
|
| 409 |
if hasattr(st.session_state, 'prediction_results'):
|