uxoxo/eb2ab
0
1# LLM Ebook Processor - Quick Start Guide2 3## Overview4 5Transform ebooks with AI language models, then convert to audiobooks.6 7**Example Use Case**: Convert a Victorian-era novel to modern English, then generate an audiobook.8 9## Installation10 11### 1. Install Dependencies12```bash13cd hf-eb2ab14pip install -r requirements.txt15```16 17### 2. Set API Keys18 19**For Claude (Anthropic)**:20```bash21# Linux/Mac22export ANTHROPIC_API_KEY=sk-ant-xxxxx23 24# Windows25set ANTHROPIC_API_KEY=sk-ant-xxxxx26```27 28**For GPT (OpenAI)**:29```bash30# Linux/Mac31export OPENAI_API_KEY=sk-xxxxx32 33# Windows34set OPENAI_API_KEY=sk-xxxxx35```36 37Get API keys:38- Anthropic: https://console.anthropic.com39- OpenAI: https://platform.openai.com/api-keys40 41## Launch42 43```bash44python app_llm_processor.py45```46 47Visit: http://localhost:786148 49## Usage Workflow50 51### Step 1: Upload & Configure52 531. **Upload your ebook** (EPUB, PDF, TXT, or HTML)54 552. **Choose chunking strategy**:56 - **By Chapter** - Best for preserving book structure57 - **Fixed Size** - Consistent chunk sizes (good for very long chapters)58 - **Sentence Boundaries** - Natural breaks (good for short stories)59 603. **Enter processing instructions**:61 ```62 Convert this Victorian-era English to modern lay English while retaining all original meaning and literary nuance63 ```64 65 Other examples:66 - "Simplify this text for a 10-year-old reader"67 - "Translate to Spanish while maintaining the original tone"68 - "Convert to casual, conversational tone"69 - "Remove archaic grammar and vocabulary"70 714. **Select LLM provider**:72 - **Claude 3 Haiku** - Fastest and cheapest (~$0.10-0.50 per book)73 - **Claude 3.5 Sonnet** - Balanced quality/cost (~$1-5 per book)74 - **GPT-4o** - Best quality (~$1-10 per book)75 - **GPT-3.5 Turbo** - Fast and cheap (~$0.25-2 per book)76 775. **Enable TTS** (optional) - Generate audiobook after LLM processing78 796. Click **"Analyze & Show Estimates"**80 81### Step 2: Review Estimates82 83You'll see:84- **Book Info**: Word count, chapters, pages85- **Cost Breakdown**: LLM + TTS costs86- **Time Estimates**: Expected processing time87- **Provider Comparison**: Cost/time for all providers88 89Example for a 200-page novel:90```91Cost Breakdown:92- LLM Processing: $0.15 - $0.3093- TTS Conversion: $12.5094- TOTAL: $12.65 - $12.8095 96Time Estimate:97- LLM Processing: 2-4 minutes98- TTS Conversion: 25-30 minutes99- TOTAL: 27-34 minutes100 101Expected Output: ~8 hours of audio102```103 104If estimates look good, click **"Confirm & Start Processing"**105 106### Step 3: LLM Processing107 108Watch real-time progress:109- Current chunk being processed110- Time elapsed and remaining111- Cost so far112- Processing speed113 114You can **pause** or **cancel** at any time.115 116### Step 4: TTS Conversion117 118Automatically starts after LLM completes (if enabled):119- Chapter-by-chapter progress120- Audio generation status121- Total cost tracking122 123### Step 5: Download124 125Get your files:126- **Processed Text** (TXT) - The LLM-transformed text127- **Audiobook** (M4B) - Ready for iTunes/audiobook apps128- **Alternative Formats** - MP3, WAV (if requested)129- **Processing Report** - Summary of costs and settings130 131## Example: Modernizing "A Tale of Two Cities"132 133### Input134```135Original (1859):136"It was the best of times, it was the worst of times,137it was the age of wisdom, it was the age of foolishness..."138```139 140### Processing Instruction141```142Convert this Victorian-era English to modern lay English143while retaining all original meaning and literary nuance144```145 146### Output147```148Modern:149"It was both the best and worst period in history,150a time of both wisdom and foolishness..."151```152 153### Results154- **Book**: A Tale of Two Cities (340 pages, 28 chapters)155- **LLM Cost**: $0.22 (Claude 3 Haiku)156- **TTS Cost**: $15.36157- **Total Cost**: $15.58158- **Processing Time**: 35 minutes159- **Output**: 7.5 hours of audio in modern English160 161## Cost Examples162 163### Small Book (50 pages, 25k words)164- **Claude Haiku**: $0.05 + $3.00 TTS = $3.05165- **GPT-4o**: $0.25 + $3.00 TTS = $3.25166- **Time**: 8-12 minutes167 168### Medium Book (200 pages, 100k words)169- **Claude Haiku**: $0.15 + $12.50 TTS = $12.65170- **GPT-4o**: $1.00 + $12.50 TTS = $13.50171- **Time**: 30-40 minutes172 173### Large Book (500 pages, 250k words)174- **Claude Haiku**: $0.40 + $31.00 TTS = $31.40175- **GPT-4o**: $2.50 + $31.00 TTS = $33.50176- **Time**: 1-2 hours177 178## Tips179 180### For Best Results181 1821. **Start small** - Test with a single chapter first1832. **Be specific** - Clear instructions get better results1843. **Check estimates** - Review costs before processing1854. **Use Haiku for testing** - Cheapest option for experiments1865. **Save good prompts** - Reuse instructions that work well187 188### Common Processing Instructions189 190**Modernization**:191```192Convert archaic language to modern English while preserving193the author's style and all original meaning194```195 196**Simplification**:197```198Rewrite for a middle school reading level (ages 11-14)199while keeping the story engaging200```201 202**Translation**:203```204Translate to Spanish. Maintain the original tone, formality level,205and cultural references where appropriate206```207 208**Tone Change**:209```210Convert from formal academic writing to casual, conversational211style suitable for a podcast script212```213 214## Troubleshooting215 216### "Missing API Key" Error217- Set environment variable (see Installation section)218- Restart the application after setting219- Try a different provider (Ollama for local/free)220 221### "Extraction Failed" Error222- Check file format is supported (EPUB, PDF, TXT, HTML)223- Try converting to a different format first224- Check file isn't DRM-protected225 226### "Processing Too Slow"227- Use a faster provider (Claude Haiku or GPT-3.5)228- Reduce chunk size (if using Fixed Size strategy)229- Try "By Chapter" strategy for faster processing230 231### "Costs Too High"232- Use Claude Haiku (cheapest)233- Disable TTS if you only need text234- Process a smaller book or single chapter first235 236## Support237 238For issues or questions:2391. Check error message for specific guidance2402. Review debug info in error messages2413. Test with a small sample file first2424. Check API key is valid and has credits243 244## Advanced Features245 246### Custom Voices (Coming Soon)247Upload your own voice sample for TTS248 249### Batch Processing (Coming Soon)250Process multiple books in sequence251 252### API Access (Coming Soon)253REST API for programmatic access254 255---256 257**Ready to transform your ebooks!**258 259Start with a small test file to get familiar with the workflow,260then process your full library.261 