entropy25 commited on
Commit
a8c7e21
Β·
verified Β·
1 Parent(s): cb98768

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +137 -1
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: '123'
3
  emoji: πŸ“‰
4
  colorFrom: gray
5
  colorTo: pink
@@ -8,3 +8,139 @@ pinned: false
8
  ---
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: 'Multilingual Sentiment Analyzer'
3
  emoji: πŸ“‰
4
  colorFrom: gray
5
  colorTo: pink
 
8
  ---
9
 
10
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
11
+ 🌍 Multilingual Sentiment Analyzer
12
+ A comprehensive AI-powered sentiment analysis application with explainable AI features (SHAP & LIME) supporting multiple languages.
13
+ πŸš€ Features
14
+
15
+ Multi-language Support: Auto-detect or manually select from English, Chinese, Spanish, French, German, Swedish
16
+ Advanced Analysis: SHAP and LIME explainable AI integration
17
+ Batch Processing: Analyze multiple texts simultaneously with parallel processing
18
+ Interactive Visualizations: Real-time charts and dashboards with Plotly
19
+ History Management: Track and export analysis history
20
+ Multiple Themes: Customizable color themes for visualizations
21
+ File Upload: Support for CSV and TXT file uploads
22
+ Export Functionality: Export results in CSV and JSON formats
23
+
24
+ πŸ“ Project Structure
25
+ sentiment_analyzer/
26
+ β”œβ”€β”€ config.py # Configuration settings
27
+ β”œβ”€β”€ models.py # Model management & sentiment engine
28
+ β”œβ”€β”€ analysis.py # SHAP/LIME explainable AI
29
+ β”œβ”€β”€ visualization.py # Plotly visualizations
30
+ β”œβ”€β”€ data_utils.py # Data processing & history management
31
+ β”œβ”€β”€ app.py # Application logic
32
+ β”œβ”€β”€ main.py # Gradio interface & startup
33
+ β”œβ”€β”€ requirements.txt # Python dependencies
34
+ β”œβ”€β”€ Dockerfile # Docker configuration
35
+ └── README.md # This file
36
+ πŸ›  Installation
37
+ Option 1: Local Installation
38
+ bash# Clone the repository
39
+ git clone <repository-url>
40
+ cd sentiment_analyzer
41
+
42
+ # Install dependencies
43
+ pip install -r requirements.txt
44
+
45
+ # Download NLTK data
46
+ python -c "import nltk; nltk.download('stopwords'); nltk.download('punkt')"
47
+
48
+ # Run the application
49
+ python main.py
50
+ Option 2: Docker
51
+ bash# Build the Docker image
52
+ docker build -t sentiment-analyzer .
53
+
54
+ # Run the container
55
+ docker run -p 7860:7860 sentiment-analyzer
56
+ Option 3: Hugging Face Spaces
57
+
58
+ Create a new Space on Hugging Face
59
+ Select "Docker" as the SDK
60
+ Upload all project files
61
+ The app will automatically deploy
62
+
63
+ 🎯 Usage
64
+ Single Text Analysis
65
+
66
+ Navigate to the "Single Analysis" tab
67
+ Enter your text in any supported language
68
+ Select language (or use Auto Detect)
69
+ Choose visualization theme
70
+ Configure preprocessing options
71
+ Click "Analyze"
72
+
73
+ Advanced Analysis (SHAP/LIME)
74
+
75
+ Go to "Advanced Analysis" tab
76
+ Enter text for explainable AI analysis
77
+ Adjust number of samples (50-300)
78
+ Click "SHAP Analysis" or "LIME Analysis"
79
+ View feature importance visualizations
80
+
81
+ Batch Processing
82
+
83
+ Switch to "Batch Analysis" tab
84
+ Upload a file or enter multiple texts (one per line)
85
+ Configure analysis settings
86
+ Click "Analyze Batch"
87
+ View summary statistics and detailed results
88
+
89
+ History & Analytics
90
+
91
+ Open "History & Analytics" tab
92
+ View comprehensive analysis dashboard
93
+ Export data in CSV or JSON format
94
+ Clear history when needed
95
+
96
+ πŸ”§ Configuration
97
+ Edit config.py to customize:
98
+
99
+ Model Settings: Change supported models and languages
100
+ Processing Limits: Adjust batch sizes and memory limits
101
+ UI Themes: Modify color schemes
102
+ Cache Settings: Configure caching parameters
103
+
104
+ πŸ“Š Supported Models
105
+
106
+ English: CardiffNLP Twitter RoBERTa
107
+ Multilingual: CardiffNLP XLM-RoBERTa
108
+ Chinese: UER RoBERTa Chinese
109
+
110
+ 🎨 Themes
111
+
112
+ Default: Green/Red/Orange
113
+ Ocean: Blue/Orange/Cyan
114
+ Dark: Darker variants
115
+ Rainbow: Purple/Pink/Red
116
+
117
+ ⚑ Performance Features
118
+
119
+ Model Caching: LRU cache for efficient model management
120
+ Parallel Processing: Multi-threaded batch analysis
121
+ Memory Optimization: Automatic cleanup and GPU management
122
+ Lazy Loading: Models loaded on-demand
123
+
124
+ πŸ› Troubleshooting
125
+ Common Issues
126
+
127
+ SHAP/LIME Errors: Reduce sample size or text length
128
+ Memory Issues: Lower batch size or enable text cleaning
129
+ Model Loading: Check internet connection for model downloads
130
+ Port Conflicts: Change port in main.py if 7860 is occupied
131
+
132
+ Performance Tips
133
+
134
+ Use GPU if available for faster processing
135
+ Enable text cleaning for better preprocessing
136
+ Reduce sample sizes for faster explainable AI analysis
137
+ Clear history periodically to save memory
138
+
139
+ πŸ“„ License
140
+ This project is open source and available under the MIT License.
141
+ 🀝 Contributing
142
+ Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
143
+ πŸ“ž Support
144
+ For support and questions, please open an issue in the repository.
145
+
146
+ Built with ❀️ using Gradio, Transformers, SHAP, LIME, and Plotly