Spaces:
Sleeping
Sleeping
Vineeth Sai commited on
Commit ·
901f1c1
1
Parent(s): 501847e
Add Space metadata to README
Browse files
README.md
CHANGED
|
@@ -1,268 +1,19 @@
|
|
| 1 |
-
# 🤖 AI Article Summarizer with Text-to-Speech
|
| 2 |
-
|
| 3 |
-
A beautiful web application that scrapes articles from URLs, generates concise summaries using Qwen3-0.6B, and optionally converts them to speech using Kokoro TTS.
|
| 4 |
-
|
| 5 |
-
## ✨ Features
|
| 6 |
-
|
| 7 |
-
- **🌐 Web Scraping**: Extract clean article text from any URL
|
| 8 |
-
- **🤖 AI Summarization**: Generate concise summaries using Qwen3-0.6B
|
| 9 |
-
- **🎵 Text-to-Speech**: Convert summaries to natural speech with Kokoro TTS
|
| 10 |
-
- **🎭 Multiple Voices**: Choose from 8 different voice options
|
| 11 |
-
- **📱 Responsive Design**: Works on desktop and mobile devices
|
| 12 |
-
- **⚡ Real-time Processing**: Live status updates and progress indicators
|
| 13 |
-
|
| 14 |
-
## 🚀 Quick Start
|
| 15 |
-
|
| 16 |
-
### 1. Clone/Download Files
|
| 17 |
-
|
| 18 |
-
Create a new directory and save these files:
|
| 19 |
-
- `app.py` - Flask web application
|
| 20 |
-
- `templates/index.html` - Web interface
|
| 21 |
-
- `setup_web_app.sh` - Setup script
|
| 22 |
-
|
| 23 |
-
### 2. Run Setup Script
|
| 24 |
-
|
| 25 |
-
```bash
|
| 26 |
-
# Make setup script executable
|
| 27 |
-
chmod +x setup_web_app.sh
|
| 28 |
-
|
| 29 |
-
# Run setup (installs everything automatically)
|
| 30 |
-
./setup_web_app.sh
|
| 31 |
-
```
|
| 32 |
-
|
| 33 |
-
### 3. Start the Web Application
|
| 34 |
-
|
| 35 |
-
```bash
|
| 36 |
-
# Activate virtual environment
|
| 37 |
-
source venv/bin/activate
|
| 38 |
-
|
| 39 |
-
# Run the Flask app
|
| 40 |
-
python app.py
|
| 41 |
-
```
|
| 42 |
-
|
| 43 |
-
### 4. Open in Browser
|
| 44 |
-
|
| 45 |
-
Navigate to: **http://localhost:5000**
|
| 46 |
-
|
| 47 |
-
## 📋 Manual Setup (Alternative)
|
| 48 |
-
|
| 49 |
-
If you prefer manual setup:
|
| 50 |
-
|
| 51 |
-
### Prerequisites
|
| 52 |
-
|
| 53 |
-
- Python 3.8+
|
| 54 |
-
- macOS: `brew install espeak`
|
| 55 |
-
- Linux: `sudo apt-get install espeak-ng`
|
| 56 |
-
|
| 57 |
-
### Installation
|
| 58 |
-
|
| 59 |
-
```bash
|
| 60 |
-
# Create virtual environment
|
| 61 |
-
python3 -m venv venv
|
| 62 |
-
source venv/bin/activate
|
| 63 |
-
|
| 64 |
-
# Install packages
|
| 65 |
-
pip install Flask torch transformers trafilatura soundfile kokoro librosa
|
| 66 |
-
|
| 67 |
-
# Create directories
|
| 68 |
-
mkdir -p templates static/audio static/summaries
|
| 69 |
-
```
|
| 70 |
-
|
| 71 |
-
## 🎭 Available Voices
|
| 72 |
-
|
| 73 |
-
| Voice | Type | Quality | Description |
|
| 74 |
-
|-------|------|---------|-------------|
|
| 75 |
-
| af_heart ❤️ | Female | A | Warm, best quality (default) |
|
| 76 |
-
| af_bella 🔥 | Female | A- | Energetic, high quality |
|
| 77 |
-
| af_nicole 🎧 | Female | B- | Professional tone |
|
| 78 |
-
| am_michael | Male | C+ | Clear male voice |
|
| 79 |
-
| am_fenrir | Male | C+ | Strong male voice |
|
| 80 |
-
| af_sarah | Female | C+ | Gentle female voice |
|
| 81 |
-
| bf_emma 🇬🇧 | Female | B- | British accent |
|
| 82 |
-
| bm_george 🇬🇧 | Male | C | British male accent |
|
| 83 |
-
|
| 84 |
-
## 🖥️ Web Interface Features
|
| 85 |
-
|
| 86 |
-
### Main Interface
|
| 87 |
-
- Clean, modern design with gradient background
|
| 88 |
-
- Real-time model loading status
|
| 89 |
-
- URL input with validation
|
| 90 |
-
- Optional text-to-speech toggle
|
| 91 |
-
- Voice selection with quality indicators
|
| 92 |
-
|
| 93 |
-
### Processing
|
| 94 |
-
- Live progress indicators
|
| 95 |
-
- Error handling with user-friendly messages
|
| 96 |
-
- Summary statistics (compression ratio, word count)
|
| 97 |
-
- Timestamp tracking
|
| 98 |
-
|
| 99 |
-
### Results
|
| 100 |
-
- Beautiful summary display with syntax highlighting
|
| 101 |
-
- Integrated audio player for TTS output
|
| 102 |
-
- Downloadable audio files
|
| 103 |
-
- Responsive design for mobile devices
|
| 104 |
-
|
| 105 |
-
## 📊 Technical Details
|
| 106 |
-
|
| 107 |
-
### AI Models Used
|
| 108 |
-
- **Qwen3-0.6B**: 600M parameter language model for summarization
|
| 109 |
-
- **Kokoro TTS**: 82M parameter text-to-speech model
|
| 110 |
-
- **Trafilatura**: Web scraping and content extraction
|
| 111 |
-
|
| 112 |
-
### Performance
|
| 113 |
-
- **Model Loading**: ~1-2 minutes on first startup
|
| 114 |
-
- **Summarization**: ~2-5 seconds per article
|
| 115 |
-
- **TTS Generation**: ~1-3 seconds for typical summaries
|
| 116 |
-
- **Memory Usage**: ~2-4GB RAM (depending on hardware)
|
| 117 |
-
|
| 118 |
-
### File Structure
|
| 119 |
-
```
|
| 120 |
-
your-project/
|
| 121 |
-
├── app.py # Flask web application
|
| 122 |
-
├── templates/
|
| 123 |
-
│ └── index.html # Web interface
|
| 124 |
-
├── static/
|
| 125 |
-
│ ├── audio/ # Generated audio files
|
| 126 |
-
│ └── summaries/ # Cached summaries (optional)
|
| 127 |
-
├── venv/ # Virtual environment
|
| 128 |
-
└── requirements.txt # Python dependencies
|
| 129 |
-
```
|
| 130 |
-
|
| 131 |
-
## 🔧 Configuration
|
| 132 |
-
|
| 133 |
-
### Environment Variables (Optional)
|
| 134 |
-
```bash
|
| 135 |
-
export FLASK_ENV=development # For debugging
|
| 136 |
-
export FLASK_PORT=5000 # Custom port
|
| 137 |
-
```
|
| 138 |
-
|
| 139 |
-
### Model Configuration
|
| 140 |
-
- Models are loaded automatically on startup
|
| 141 |
-
- First run downloads ~1.2GB of model files
|
| 142 |
-
- Models are cached locally for faster subsequent starts
|
| 143 |
-
|
| 144 |
-
## 🐛 Troubleshooting
|
| 145 |
-
|
| 146 |
-
### Common Issues
|
| 147 |
-
|
| 148 |
-
**Models not loading**
|
| 149 |
-
```bash
|
| 150 |
-
# Check internet connection and disk space
|
| 151 |
-
df -h
|
| 152 |
-
ping huggingface.co
|
| 153 |
-
```
|
| 154 |
-
|
| 155 |
-
**espeak not found**
|
| 156 |
-
```bash
|
| 157 |
-
# macOS
|
| 158 |
-
brew install espeak
|
| 159 |
-
|
| 160 |
-
# Linux
|
| 161 |
-
sudo apt-get install espeak-ng
|
| 162 |
-
```
|
| 163 |
-
|
| 164 |
-
**Permission errors**
|
| 165 |
-
```bash
|
| 166 |
-
# Make sure virtual environment is activated
|
| 167 |
-
source venv/bin/activate
|
| 168 |
-
which python # Should show venv path
|
| 169 |
-
```
|
| 170 |
-
|
| 171 |
-
**Port already in use**
|
| 172 |
-
```bash
|
| 173 |
-
# Kill process using port 5000
|
| 174 |
-
lsof -ti:5000 | xargs kill -9
|
| 175 |
-
|
| 176 |
-
# Or use different port
|
| 177 |
-
python app.py --port 5001
|
| 178 |
-
```
|
| 179 |
-
|
| 180 |
-
### Performance Optimization
|
| 181 |
-
|
| 182 |
-
**For faster startup:**
|
| 183 |
-
- Keep models in memory between requests
|
| 184 |
-
- Use SSD storage for model cache
|
| 185 |
-
- Ensure sufficient RAM (4GB+ recommended)
|
| 186 |
-
|
| 187 |
-
**For better quality:**
|
| 188 |
-
- Use `af_heart` or `af_bella` voices
|
| 189 |
-
- Keep summaries under 500 words for best TTS quality
|
| 190 |
-
- Use clean, well-formatted article URLs
|
| 191 |
-
|
| 192 |
-
## 📱 Usage Tips
|
| 193 |
-
|
| 194 |
-
1. **Best Article Sources**: News sites, blogs, Wikipedia work well
|
| 195 |
-
2. **URL Format**: Use full URLs (https://example.com/article)
|
| 196 |
-
3. **Summary Length**: Typically 100-300 words from longer articles
|
| 197 |
-
4. **Audio Quality**: Higher-grade voices sound more natural
|
| 198 |
-
5. **Mobile Use**: Interface is fully responsive
|
| 199 |
-
|
| 200 |
-
## 🔒 Privacy & Security
|
| 201 |
-
|
| 202 |
-
- No article content is stored permanently
|
| 203 |
-
- Audio files are generated locally
|
| 204 |
-
- No data is sent to external services (except model downloads)
|
| 205 |
-
- All processing happens on your machine
|
| 206 |
-
|
| 207 |
-
## 🚀 Advanced Usage
|
| 208 |
-
|
| 209 |
-
### API Endpoints
|
| 210 |
-
|
| 211 |
-
The web app exposes these endpoints:
|
| 212 |
-
|
| 213 |
-
- `GET /` - Main interface
|
| 214 |
-
- `GET /status` - Model loading status
|
| 215 |
-
- `GET /voices` - Available voice list
|
| 216 |
-
- `POST /process` - Process article (JSON)
|
| 217 |
-
|
| 218 |
-
### Example API Usage
|
| 219 |
-
```javascript
|
| 220 |
-
fetch('/process', {
|
| 221 |
-
method: 'POST',
|
| 222 |
-
headers: {'Content-Type': 'application/json'},
|
| 223 |
-
body: JSON.stringify({
|
| 224 |
-
url: 'https://example.com/article',
|
| 225 |
-
generate_audio: true,
|
| 226 |
-
voice: 'af_heart'
|
| 227 |
-
})
|
| 228 |
-
});
|
| 229 |
-
```
|
| 230 |
-
|
| 231 |
-
## 📈 Future Enhancements
|
| 232 |
-
|
| 233 |
-
Possible improvements:
|
| 234 |
-
- Multiple language support
|
| 235 |
-
- Custom voice training
|
| 236 |
-
- Batch processing
|
| 237 |
-
- Summary length control
|
| 238 |
-
- Export options (PDF, EPUB)
|
| 239 |
-
- Integration with read-later apps
|
| 240 |
-
|
| 241 |
-
## 🤝 Contributing
|
| 242 |
-
|
| 243 |
-
Feel free to:
|
| 244 |
-
- Report bugs
|
| 245 |
-
- Suggest features
|
| 246 |
-
- Submit improvements
|
| 247 |
-
- Share cool use cases
|
| 248 |
-
|
| 249 |
-
## 📄 License
|
| 250 |
-
|
| 251 |
-
This project uses:
|
| 252 |
-
- Qwen3-0.6B (Apache 2.0)
|
| 253 |
-
- Kokoro TTS (Apache 2.0)
|
| 254 |
-
- Flask (BSD)
|
| 255 |
-
- Other open-source libraries
|
| 256 |
-
|
| 257 |
-
## 🙏 Acknowledgments
|
| 258 |
-
|
| 259 |
-
- **Qwen Team** for the summarization model
|
| 260 |
-
- **hexgrad** for Kokoro TTS
|
| 261 |
-
- **Trafilatura** for web scraping
|
| 262 |
-
- **Flask** for the web framework
|
| 263 |
-
|
| 264 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
|
| 266 |
-
**
|
|
|
|
| 267 |
|
| 268 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
+
short_description: Dark, fluid Flask app that scrapes articles, summarizes with Qwen 0.6B, and optionally speaks results with Kokoro TTS. CPU-only, no accounts needed.
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# AI Article Summarizer
|
| 13 |
|
| 14 |
+
Dark, fluid Flask app that scrapes articles, summarizes with **Qwen 0.6B**, and optionally speaks results with **Kokoro TTS**.
|
| 15 |
+
Runs on the free CPU tier. First run downloads models; later requests are fast.
|
| 16 |
|
| 17 |
+
## Tips
|
| 18 |
+
- If a site blocks scraping, paste the text or set `ALLOW_PROXY_FALLBACK=1` in Space settings.
|
| 19 |
+
- Status endpoint: `/status`.
|