Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -438,18 +438,18 @@ if st.session_state.analysis_stage >= 2 and st.session_state.ensemble_result is
|
|
438 |
- No significant red flags were detected in the ensemble
|
439 |
""")
|
440 |
|
441 |
-
# Final verdict
|
442 |
-
st.
|
443 |
-
|
444 |
-
|
445 |
-
is_malicious_ensemble = results['ensemble'] == 1
|
446 |
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
|
|
453 |
|
454 |
# Reset button
|
455 |
if st.button("Analyze Another Query"):
|
|
|
438 |
- No significant red flags were detected in the ensemble
|
439 |
""")
|
440 |
|
441 |
+
# Final ensemble verdict
|
442 |
+
st.markdown("### Ensemble Verdict")
|
443 |
+
vote_benign = results['vote_count'][0] # Votes for safe
|
444 |
+
vote_malicious = results['vote_count'][1] # Votes for malicious
|
|
|
445 |
|
446 |
+
# Decision-making based on votes
|
447 |
+
if vote_benign > 3: # Safe votes must be greater than 3
|
448 |
+
st.success("✅ Query deemed safe by majority vote")
|
449 |
+
elif vote_malicious > 3: # Malicious votes greater than 3
|
450 |
+
st.error("🚨 SQL Injection Detected by Majority Vote!")
|
451 |
+
else: # Tie or ambiguous case (e.g., 2 safe, 2 malicious)
|
452 |
+
st.warning("⚠️ Ambiguous result: The votes are evenly split. Please cross-check the query manually.")
|
453 |
|
454 |
# Reset button
|
455 |
if st.button("Analyze Another Query"):
|