A beginner-friendly desktop app for translating spoken or typed text between dozens of languages, powered by local AI (Ollama Llama 3.2) and a simple, beautiful interface.
- Speak or type to translate between 30+ languages
- Simple, modern, and accessible UI
- Visual timer while recording
- Clear status feedback (Ready, Recording, Processing, Error, Done)
- All actions (Record, Stop, Clear, Translate) are one-click
- No internet required for translation (uses local Ollama model)
- Logs all sessions for review
speech_recognitionrequeststkinter(comes with most Python installations)pyaudio(for microphone input)
Install them with:
pip install speechrecognition requests pyaudiobrew install portaudio
pip install pyaudio- Install Ollama
- Pull the Llama 3.2 model:
ollama pull llama3.2- Start the Ollama server:
ollama serve- Make sure Ollama is running (
ollama servein a terminal). - In another terminal, run:
python langAssist.py- Select source and target languages from the dropdowns.
- To speak:
- Click Record and speak your phrase.
- Click Stop when finished.
- The app will transcribe and translate your speech.
- To type:
- Type your text in the Transcript box.
- Click Translate.
- Clear resets everything for a new translation.
- The Translation box will show your result.
- The status bar at the bottom shows what the app is doing.
- Microphone not working?
- Make sure your mic is plugged in and not muted.
- On macOS, you may need to grant Terminal or Python access to the microphone in System Settings > Privacy & Security > Microphone.
- If you see a PortAudio error, install it with
brew install portaudio(macOS) and reinstallpyaudio.
- Ollama errors?
- Make sure you have run
ollama serveand pulled thellama3.2model. - The app must be able to connect to
http://localhost:11434.
- Make sure you have run
- Buttons require a hard click?
- Enable "Tap to click" in your Mac's Trackpad settings.
- App looks weird or text is missing?
- Make sure you are running Python 3.8+ and have all dependencies installed.
(Add screenshots here after running the app!)
- Built with Tkinter, SpeechRecognition, Ollama, and Llama 3.2.
Prompt:
Build a Python desktop app using Tkinter called "Voice-Powered Language Translator" with the following requirements:
Language Selection:
- Provide two dropdown menus at the top: one for "Translate from" and one for "Translate to".
- Include at least 30 languages (e.g., English, Spanish, French, German, Chinese, Japanese, etc.).
- Prevent the user from selecting the same language for both dropdowns (show a warning if attempted).
Input Methods:
- Allow the user to either:
- Click a large, clearly labeled Record button to start recording speech from the microphone, and a Stop button to end recording (no auto-stop; only user stops it).
- Or type directly into a large, editable Transcript text area.
Visual Timer:
- While recording, display a timer (in seconds) in the status bar, updating every second.
Translation:
- After recording, automatically transcribe the speech and place it in the Transcript box.
- Provide a large, clearly labeled Translate button that translates the text in the Transcript box (whether typed or transcribed).
- Show the translation in a large, read-only Translation text area below.
UI/UX:
- Use a modern, light color palette: light backgrounds, dark text, and visually distinct, color-coded status bar (e.g., green for Ready, yellow for Recording, blue for Processing, red for Error, purple for Done).
- All buttons (Record, Stop, Clear, Translate) should be large, touch-friendly, and have high-contrast text.
- Add a Clear button to reset both text areas and the status bar.
- Add clear, beginner-friendly instructions at the top of the window.
- Make the window and text areas resizable.
Status Bar:
- Show a persistent status bar at the bottom with color-coded feedback: Ready, Recording, Processing, Error, Done.
AI Integration:
- Use the local Ollama Llama 3.2 model for translation by sending a POST request to
http://localhost:11434/api/generatewith the following JSON:{"model": "llama3.2", "prompt": "Translate from [FROM] to [TO]: [TEXT]", "stream": false}- Extract the translation from the
responsefield of the returned JSON.- Handle connection errors gracefully (show a user-friendly error message if Ollama is not running).
Logging:
- Log each session (transcript, prompt, translation) to a timestamped text file in a
logs/folder.Dependencies:
- Only require Python, Tkinter, SpeechRecognition, requests, pyaudio, and Ollama (with Llama 3.2 model).
Error Handling:
- Show clear, user-friendly error messages for microphone issues, API errors, or invalid input.
- Prevent the app from crashing on any user action.
Accessibility:
- Ensure all text is readable (large font, high contrast).
- All actions should be accessible by mouse or touch (no keyboard required).
Beginner-Friendliness:
- The app should be easy to use for someone with no programming experience.
- Include clear instructions and feedback for every action.
General:
- The app should be robust, visually appealing, and require no internet connection for translation.
- The code should be clean, well-commented, and easy to follow.