Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -451,22 +451,7 @@ with gr.Blocks(
|
|
451 |
theme=gr.themes.Soft()
|
452 |
) as demo:
|
453 |
|
454 |
-
gr.Markdown("""
|
455 |
-
# 🔧 Fixed Multi-Agent Hate Speech Detection System
|
456 |
|
457 |
-
**Corrected Logic & Optimized Performance**
|
458 |
-
|
459 |
-
🔍 **Detection Agent** - Your fine-tuned DistilBERT with **fixed label interpretation**
|
460 |
-
📊 **Sentiment Agent** - Twitter-RoBERTa for emotional context
|
461 |
-
🛡️ **Moderation Agent** - Fast template-based analysis
|
462 |
-
💬 **Counter-Speech Agent** - Educational template responses
|
463 |
-
|
464 |
-
**🔧 Key Fixes Applied:**
|
465 |
-
- ✅ **Corrected label mapping** (LABEL_0 vs LABEL_1)
|
466 |
-
- ⚡ **Optimized performance** (<5 seconds vs 260 seconds)
|
467 |
-
- 🎯 **Accurate classification** of positive/negative content
|
468 |
-
- 📊 **Clear confidence scoring** with hate vs normal breakdown
|
469 |
-
""")
|
470 |
|
471 |
with gr.Row():
|
472 |
with gr.Column(scale=2):
|
@@ -519,29 +504,6 @@ with gr.Blocks(
|
|
519 |
visible=True
|
520 |
)
|
521 |
|
522 |
-
gr.Markdown("""
|
523 |
-
## 🔧 What Was Fixed
|
524 |
-
|
525 |
-
### 🎯 **Label Mapping Issue**
|
526 |
-
- **Problem**: System was interpreting labels backwards
|
527 |
-
- **Solution**: Added model testing to determine correct mapping
|
528 |
-
- **Result**: Positive text now correctly classified as safe
|
529 |
-
|
530 |
-
### ⚡ **Performance Optimization**
|
531 |
-
- **Problem**: 260+ second processing time
|
532 |
-
- **Solution**: Removed heavy FLAN-T5 models, used templates
|
533 |
-
- **Result**: <5 second response time
|
534 |
-
|
535 |
-
### 📊 **Transparency Improvements**
|
536 |
-
- **Added**: Hate vs Normal score breakdown
|
537 |
-
- **Added**: Model label mapping display
|
538 |
-
- **Added**: Clear confidence metrics
|
539 |
-
|
540 |
-
### 🛡️ **Reliability Enhancements**
|
541 |
-
- **Better error handling** for model loading
|
542 |
-
- **Fallback mechanisms** for failed components
|
543 |
-
- **Comprehensive logging** for debugging
|
544 |
-
""")
|
545 |
|
546 |
# Event handlers
|
547 |
analyze_btn.click(
|
|
|
451 |
theme=gr.themes.Soft()
|
452 |
) as demo:
|
453 |
|
|
|
|
|
454 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
455 |
|
456 |
with gr.Row():
|
457 |
with gr.Column(scale=2):
|
|
|
504 |
visible=True
|
505 |
)
|
506 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
507 |
|
508 |
# Event handlers
|
509 |
analyze_btn.click(
|