Spaces:
Running
on
Zero
Running
on
Zero
Update README_.md
Browse files- README_.md +39 -73
README_.md
CHANGED
@@ -6,6 +6,14 @@ A robust multimodal system for detecting and rephrasing profanity in both speech
|
|
6 |

|
7 |

|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
## π Features
|
10 |
|
11 |
- **Multimodal Analysis**: Process both written text and spoken audio
|
@@ -19,6 +27,7 @@ A robust multimodal system for detecting and rephrasing profanity in both speech
|
|
19 |
- **Visual Highlighting**: Instantly identify problematic words with visual highlighting
|
20 |
- **Toxicity Classification**: Automatically categorize content from "No Toxicity" to "Severe Toxicity"
|
21 |
- **Performance Optimization**: Half-precision support for improved GPU memory efficiency
|
|
|
22 |
|
23 |
## π§ Models Used
|
24 |
|
@@ -29,19 +38,29 @@ The system leverages four powerful models:
|
|
29 |
3. **Speech-to-Text**: OpenAI's `Whisper` (large) - For transcribing spoken audio
|
30 |
4. **Text-to-Speech**: Microsoft's `SpeechT5` - For converting rephrased text back to audio
|
31 |
|
32 |
-
##
|
|
|
|
|
33 |
|
34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
- Python 3.10+
|
37 |
- CUDA-compatible GPU recommended (but CPU mode works too)
|
38 |
- FFmpeg for audio processing
|
39 |
|
40 |
-
|
41 |
|
42 |
```bash
|
43 |
# Clone the repository
|
44 |
-
git clone https://github.com/
|
45 |
cd profanity-detection
|
46 |
|
47 |
# Method A: Create environment from environment.yml (recommended)
|
@@ -69,11 +88,11 @@ conda env config vars set KMP_DUPLICATE_LIB_OK=TRUE
|
|
69 |
conda activate profanity-detection # Re-activate to apply the variable
|
70 |
```
|
71 |
|
72 |
-
|
73 |
|
74 |
```bash
|
75 |
# Clone the repository
|
76 |
-
git clone https://github.com/
|
77 |
cd profanity-detection
|
78 |
|
79 |
# Build and run the Docker container
|
@@ -82,25 +101,15 @@ docker-compose build --no-cache
|
|
82 |
docker-compose up
|
83 |
```
|
84 |
|
85 |
-
##
|
86 |
-
|
87 |
-
### Running the Application
|
88 |
-
|
89 |
-
```bash
|
90 |
-
# Set environment variable to avoid OpenMP conflicts (if not set in conda config)
|
91 |
-
# For Windows:
|
92 |
-
set KMP_DUPLICATE_LIB_OK=TRUE
|
93 |
-
|
94 |
-
# For Linux/Mac:
|
95 |
-
export KMP_DUPLICATE_LIB_OK=TRUE
|
96 |
|
97 |
-
|
98 |
-
python profanity_detector.py
|
99 |
-
```
|
100 |
|
101 |
-
|
|
|
|
|
102 |
|
103 |
-
### Using the Interface
|
104 |
|
105 |
1. **Initialise Models**
|
106 |
- Click the "Initialize Models" button when you first open the interface
|
@@ -127,46 +136,6 @@ The Gradio interface will be accessible at http://127.0.0.1:7860 in your browser
|
|
127 |
- Listen to the clean audio output
|
128 |
- Click "Stop Real-time Processing" when finished
|
129 |
|
130 |
-
## π§ Deployment Options
|
131 |
-
|
132 |
-
### Local Deployment with Conda
|
133 |
-
|
134 |
-
For the best development experience with fine-grained control:
|
135 |
-
|
136 |
-
```bash
|
137 |
-
# Create and configure environment
|
138 |
-
conda env create -f environment.yml
|
139 |
-
conda activate llm_project
|
140 |
-
|
141 |
-
# Run with sharing enabled (accessible from other devices)
|
142 |
-
python profanity_detector.py
|
143 |
-
```
|
144 |
-
|
145 |
-
### Docker Deployment (Production)
|
146 |
-
|
147 |
-
For containerised deployment with predictable environment:
|
148 |
-
|
149 |
-
#### Basic CPU Deployment
|
150 |
-
```bash
|
151 |
-
docker-compose up --build
|
152 |
-
```
|
153 |
-
|
154 |
-
#### GPU-Accelerated Deployment
|
155 |
-
```bash
|
156 |
-
# Automatic detection (recommended)
|
157 |
-
docker-compose up --build
|
158 |
-
|
159 |
-
# Or explicitly request GPU mode
|
160 |
-
docker-compose up --build profanity-detector-gpu
|
161 |
-
```
|
162 |
-
|
163 |
-
No need to edit any configuration files - the system will automatically detect and use your GPU if available.
|
164 |
-
|
165 |
-
#### Custom Port Configuration
|
166 |
-
To change the default port (7860):
|
167 |
-
1. Edit docker-compose.yml and change the port mapping (e.g., "8080:7860")
|
168 |
-
2. Run `docker-compose up --build`
|
169 |
-
|
170 |
## β οΈ Troubleshooting
|
171 |
|
172 |
### OpenMP Runtime Conflict
|
@@ -230,18 +199,13 @@ If you encounter CUDA out of memory errors:
|
|
230 |
memory: 4G # Limit to 4GB of GPU memory
|
231 |
```
|
232 |
|
233 |
-
###
|
234 |
|
235 |
-
1. **
|
236 |
-
|
237 |
-
|
238 |
-
sudo chown -R $USER:$USER .
|
239 |
-
```
|
240 |
|
241 |
-
|
242 |
-
- Verify NVIDIA Container Toolkit installation
|
243 |
-
- Check GPU driver compatibility
|
244 |
-
- Run `nvidia-smi` on the host to confirm GPU availability
|
245 |
|
246 |
### First-Time Slowness
|
247 |
|
@@ -265,6 +229,7 @@ profanity-detection/
|
|
265 |
- [OpenAI Whisper](https://github.com/openai/whisper)
|
266 |
- [Microsoft SpeechT5](https://huggingface.co/microsoft/speecht5_tts)
|
267 |
- [Gradio Documentation](https://gradio.app/docs/)
|
|
|
268 |
|
269 |
## π License
|
270 |
|
@@ -273,4 +238,5 @@ This project is licensed under the MIT License - see the LICENSE file for detail
|
|
273 |
## π Acknowledgments
|
274 |
|
275 |
- This project utilises models from HuggingFace Hub, Microsoft, and OpenAI
|
276 |
-
- Inspired by research in content moderation and responsible AI
|
|
|
|
6 |

|
7 |

|
8 |
|
9 |
+
## π Live Demo
|
10 |
+
|
11 |
+
Try the system without installation via our Hugging Face Spaces deployment:
|
12 |
+
|
13 |
+
[](https://huggingface.co/spaces/nightey3s/profanity-detection)
|
14 |
+
|
15 |
+
This live version leverages Hugging Face's ZeroGPU technology, which provides on-demand GPU acceleration for inference while optimising resource usage.
|
16 |
+
|
17 |
## π Features
|
18 |
|
19 |
- **Multimodal Analysis**: Process both written text and spoken audio
|
|
|
27 |
- **Visual Highlighting**: Instantly identify problematic words with visual highlighting
|
28 |
- **Toxicity Classification**: Automatically categorize content from "No Toxicity" to "Severe Toxicity"
|
29 |
- **Performance Optimization**: Half-precision support for improved GPU memory efficiency
|
30 |
+
- **Cloud Deployment**: Available as a hosted service on Hugging Face Spaces
|
31 |
|
32 |
## π§ Models Used
|
33 |
|
|
|
38 |
3. **Speech-to-Text**: OpenAI's `Whisper` (large) - For transcribing spoken audio
|
39 |
4. **Text-to-Speech**: Microsoft's `SpeechT5` - For converting rephrased text back to audio
|
40 |
|
41 |
+
## π Deployment Options
|
42 |
+
|
43 |
+
### Online Deployment (No Installation Required)
|
44 |
|
45 |
+
Access the application directly through Hugging Face Spaces:
|
46 |
+
- **URL**: [https://huggingface.co/spaces/nightey3s/profanity-detection](https://huggingface.co/spaces/nightey3s/profanity-detection)
|
47 |
+
- **Technology**: Built with ZeroGPU for efficient GPU resource allocation
|
48 |
+
- **Features**: All features of the full application accessible through your browser
|
49 |
+
- **Source Code**: [GitHub Repository](https://github.com/Nightey3s/profanity-detection)
|
50 |
+
|
51 |
+
### Local Installation
|
52 |
+
|
53 |
+
#### Prerequisites
|
54 |
|
55 |
- Python 3.10+
|
56 |
- CUDA-compatible GPU recommended (but CPU mode works too)
|
57 |
- FFmpeg for audio processing
|
58 |
|
59 |
+
#### Option 1: Using Conda (Recommended for Local Development)
|
60 |
|
61 |
```bash
|
62 |
# Clone the repository
|
63 |
+
git clone https://github.com/Nightey3s/profanity-detection.git
|
64 |
cd profanity-detection
|
65 |
|
66 |
# Method A: Create environment from environment.yml (recommended)
|
|
|
88 |
conda activate profanity-detection # Re-activate to apply the variable
|
89 |
```
|
90 |
|
91 |
+
#### Option 2: Using Docker
|
92 |
|
93 |
```bash
|
94 |
# Clone the repository
|
95 |
+
git clone https://github.com/Nightey3s/profanity-detection.git
|
96 |
cd profanity-detection
|
97 |
|
98 |
# Build and run the Docker container
|
|
|
101 |
docker-compose up
|
102 |
```
|
103 |
|
104 |
+
## π§ Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
+
### Using the Online Interface (Hugging Face Spaces)
|
|
|
|
|
107 |
|
108 |
+
1. Visit [https://huggingface.co/spaces/nightey3s/profanity-detection](https://huggingface.co/spaces/nightey3s/profanity-detection)
|
109 |
+
2. The interface might take a moment to load on first access as it allocates resources
|
110 |
+
3. Follow the same usage instructions as below, starting with "Initialize Models"
|
111 |
|
112 |
+
### Using the Local Interface
|
113 |
|
114 |
1. **Initialise Models**
|
115 |
- Click the "Initialize Models" button when you first open the interface
|
|
|
136 |
- Listen to the clean audio output
|
137 |
- Click "Stop Real-time Processing" when finished
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
## β οΈ Troubleshooting
|
140 |
|
141 |
### OpenMP Runtime Conflict
|
|
|
199 |
memory: 4G # Limit to 4GB of GPU memory
|
200 |
```
|
201 |
|
202 |
+
### Hugging Face Spaces-Specific Issues
|
203 |
|
204 |
+
1. **Long initialization time**: The first time you access the Space, it may take longer to initialize as models are downloaded and cached.
|
205 |
+
|
206 |
+
2. **Timeout errors**: If the model takes too long to process your request, try again with shorter text or audio inputs.
|
|
|
|
|
207 |
|
208 |
+
3. **Browser compatibility**: Ensure your browser allows microphone access for audio recording features.
|
|
|
|
|
|
|
209 |
|
210 |
### First-Time Slowness
|
211 |
|
|
|
229 |
- [OpenAI Whisper](https://github.com/openai/whisper)
|
230 |
- [Microsoft SpeechT5](https://huggingface.co/microsoft/speecht5_tts)
|
231 |
- [Gradio Documentation](https://gradio.app/docs/)
|
232 |
+
- [Hugging Face Spaces](https://huggingface.co/spaces)
|
233 |
|
234 |
## π License
|
235 |
|
|
|
238 |
## π Acknowledgments
|
239 |
|
240 |
- This project utilises models from HuggingFace Hub, Microsoft, and OpenAI
|
241 |
+
- Inspired by research in content moderation and responsible AI
|
242 |
+
- Hugging Face for providing the Spaces platform with ZeroGPU technology
|