I have managed to achieve progress using PyInstaller + NSIS and the PyTorch version of OpenNMT.
Creating an executable version of OpenNMT-py that requires the minimal technical experience to install and use, and no Internet connection.
A proof-of-concept version can be downloaded at: https://s3.us-west-2.amazonaws.com/opennmt-gui/translate-gui.exe
Tested on Windows 7 and 10. Support for 64bit version of Windows only (PyTorch works on Python 64bit only).
How it works:
After launching the installer, it will copy the files to the “Program Files” folder. When the installer finishes, there will be a shortcut on the Desktop called “translate-gui”.
Running the shortcut “translate-gui” (which refers to translate-gui.exe), this window opens.
- Select the source file (*.txt)
- Select the model file (*.pt)
- Click “Translate”.
- If everything works fine, it should create the translation file “youtranslation.txt” on the Desktop.
To uninstall, simply delete the folder “translate-gui” from the “Program Files” folder.
Changes in the OpenNMT-py code:
Simple use of the same arguments; no serious changes.
1- translate.py - assigning values from the GUI to these variables:
opt.src (source file path - string)
opt.models (model file path - list of strings)
opt.output (target file path - string)
For the arguments
-model, changing the attribute “required=True” to “required=False”
So that is it. This is for the local version. My next test should be for the server version.
More details can be found here.