A powerful PySide6-based GUI application for batch processing text files using Ollama LLM models. Supports translation, audiobook formatting, and intelligent text paraphrasing with customizable pipeline operations.
- π Translation: Professional translation between languages with context preservation
- π§ Audiobook Formatting: Optimize text for text-to-speech systems
- βοΈ Paraphrasing: Improve flow, simplify language, remove idioms, adjust tone
- π Pipeline Processing: Chain multiple operations in custom order
- βοΈ Smart Chunking: Intelligent text splitting with overlap and boundary detection
- πΎ Progressive Saving: Each pipeline step saved to separate files
- π Batch Processing: Process multiple files sequentially
- π― Model Selection: Use different Ollama models per operation
- Python 3.8+
- Ollama installed and running
- At least one Ollama model installed
Download and install from ollama.ai
# Install a model
ollama pull mistral
# or
ollama pull llama3.2
ollama pull aya-expanse:32bpip install PySide6 aiohttp qasync ollama# Start Ollama server (in separate terminal)
ollama serve
# Run the application
python main.pyEdit config.json to customize:
- Ollama host: Default
http://localhost:11434 - Chunking presets: Adjust chunk sizes and overlap
- Operation settings: Modify prompts, icons, defaults
- UI settings: Window size, titles
- Start Ollama: Run
ollama servein a terminal - Launch App: Run
python main.py - Add Files: Click "π Add File" and select .txt files
- Configure Pipeline:
- Check operations to enable (Translation, Audiobook, Paraphrase)
- Drag operations to reorder
- Configure each operation's settings
- Select Models: Choose Ollama model for each operation
- Set Chunking: Select preset or enable "Process entire file"
- Start Processing: Click "π START"
- Monitor Progress: Watch Activity Log and progress bar
- Access Outputs: Find processed files and step files in output directory
- Set source and target languages
- Handles idioms intelligently
- Maintains consistency across chunks
- Temperature: 0.2-0.4 recommended
Enable options:
- Expand Contractions: "don't" β "do not"
- Spell Out Numbers: "123" β "one hundred twenty-three"
- Remove Special Characters: Clean non-standard symbols
- Add Reading Markers: Insert TTS-friendly markers
Enable sub-operations:
- Improve Flow: Better sentence structure and transitions
- Simplify Language: Make complex text accessible
- Remove Idioms: Convert figurative to literal language
- Adjust Tone: Formal, casual, professional, or conversational
Presets:
- Fast (2000/150): Quick processing
- Balanced (2500/200): Default, good quality
- High Context (3000/250): Better continuity
- Large (4000/300): Fewer API calls
- Extra Large (6000/400): Maximum context
Process Entire File: Disable chunking for small files (< 2500 chars)
The application creates multiple output files:
input.txt # Original file
input_step_01_translated.txt # After translation
input_step_02_audiobook.txt # After audiobook formatting
input_processed.txt # Final output
Check:
- Is Ollama running? β
ollama serve - Is a model installed? β
ollama list - Did you add input files?
- Is at least one operation checked?
- Is a model selected in dropdown?
# Test Ollama
ollama list
# If empty, install a model
ollama pull mistral
# Test inference
ollama run mistral "hello"Large models (30B+) take 1-2 minutes to load on first use. Watch console output for [DEBUG] messages.
- Smaller chunks: Faster processing, less context
- Larger chunks: Slower but better quality
- Combined operations: More efficient than separate runs
- Fast models: Use smaller quantized models for speed
- GPU: Ensure Ollama uses GPU for better performance
Edit config.json operation prompts:
{
"operations": {
"translation": {
"prompts": {
"system_first": "Your custom system prompt...",
"user_first": "Your custom user prompt..."
}
}
}
}- Translation: 0.2-0.4 (deterministic)
- Paraphrasing: 0.4-0.6 (creative)
- Creative Writing: 0.7-1.0 (very creative)
Operations execute in order from top to bottom. Typical workflows:
- Translation β Audiobook: Translate then optimize for TTS
- Paraphrase β Simplify β Remove Idioms: Multi-step text cleanup
- Translation β Paraphrase (tone): Translate and adjust formality
- Ctrl+O: Add files
- Ctrl+S: Select output directory
- Ctrl+R: Start processing
- Esc: Stop processing
python test_ollama.pyShows detailed connection diagnostics and model availability.
Console output shows [DEBUG] messages for:
- Model calls with parameters
- Response types and content length
- Error tracebacks
- Pipeline execution flow
- Only .txt files supported
- No real-time progress within chunks (model inference time varies)
- Large models require significant RAM/VRAM
- Async operations prevent UI responsiveness during heavy processing
- Pre-process text: Remove excessive whitespace, fix encoding
- Use appropriate models: Match model size to task complexity
- Test with small files first: Verify settings before batch processing
- Monitor first chunk: Shows model loading time and quality
- Enable deduplication: Removes duplicate paragraphs at chunk boundaries
- Save intermediate steps: Useful for debugging and iterative refinement
- main.py: PySide6 GUI and application logic
- Translator.py: Ollama API interface and text processing
- config.json: Configuration and prompts
- qasync: Async event loop integration with Qt
MIT License - feel free to modify and distribute.
Improvements welcome! Focus areas:
- Additional operation types
- Better error recovery
- Real-time streaming output
- Support for other file formats
- Memory optimization for large files
Built with:
Version: 1.0
Last Updated: October 2025