A simple tool that translates movie subtitles (.srt files) to Persian using AI
This app helps you translate subtitle files from any language to Persian. All you need to do is upload your subtitle file, click a button, and download the translated version!
- A Computer with Windows, Mac, or Linux
- Python (version 3.12 or newer) installed on your computer
- Ollama - a free AI tool that runs on your computer
- Internet Connection to download the necessary files
If you don't already have Python installed:
- Go to Python.org
- Click the big "Download Python" button
- Run the installer and make sure to check "Add Python to PATH" during installation
Ollama is the AI engine that powers the translations:
- Visit Ollama.ai/download
- Download the version for your computer (Windows, Mac, or Linux)
- Install it by following the on-screen instructions
- Once installed, Ollama will run in the background (you'll see its icon in your system tray or menu bar)
Option A: Direct Download (Easiest)
- Click the green "Code" button at the top of this page
- Select "Download ZIP"
- Unzip the downloaded file to a folder on your computer
Option B: Using Command Line
git clone https://github.com/mshojaei77/SubTrans-Ollama.git
cd SubTrans-Ollama- Open your computer's command prompt or terminal
- On Windows: Press Win+R, type "cmd" and press Enter
- On Mac: Open the Terminal app from Applications > Utilities
- Navigate to the folder where you saved the app:
cd path/to/SubTrans-Ollama - Install the required components:
pip install -r requirements.txt
-
Start Ollama if it's not already running
- On Windows: Find Ollama in your Start menu
- On Mac: Find Ollama in your Applications folder
-
Start the translation app:
- Open your command prompt/terminal
- Navigate to the app folder
- Type:
streamlit run app.py - Your web browser will automatically open with the app
-
Using the app:
- Upload your subtitle file by clicking "Browse files"
- Choose your settings (or leave as default)
- Click "Translate Subtitles" and wait for it to finish
- Click "Download Translated SRT" to save your Persian subtitles
- Ollama Model: Which AI to use for translation. The default option is best for most users.
- Context Window Size: How many surrounding subtitles the AI looks at. Larger number = better translations but slower.
- Batch Size: How many subtitles to translate at once. Larger number = faster but uses more computer power.
- Delay Between Batches: How long to wait between groups of translations. Helps prevent your computer from getting too hot.
- Make sure you have administrator access on your computer.
- Try downloading Python from the Microsoft Store if you're on Windows 10 or 11.
- Make sure Ollama is running (check for its icon in your system tray).
- Restart your computer and try again.
- For Mac users: You might need to right-click the app and select "Open" the first time.
- ensure no proxy is running on your computer in 127.0.0.1:11434 (this is the default port for ollama)
- Make sure you installed all requirements:
pip install -r requirements.txt - Try restarting Ollama.
- Check that you're using Python 3.12 or newer: type
python --versionin your terminal.
- Try increasing the "Context Window Size" to 5 or higher.
- Make sure you're using the recommended model (mshojaei77/gemma3persian).
- Reduce the "Batch Size". A smaller batch size uses less processing power at once.
- Increase the "Delay Between Batches". This gives your computer more time to cool down between processing chunks of subtitles.
- Consider using a lighter model like gemma3:1b instead of gemma3persian for faster processing, though translations may be less accurate.
- If you have a dedicated GPU, ensure Ollama is configured to use it. Consult the Ollama documentation for GPU configuration.
- Close other applications that may be using significant CPU or GPU resources.
- Create an "Issue" on this GitHub page
MIT License - Free to use for everyone!


