Create and activate virtual environment:
python -m venv venv
.\venv\Scripts\activateInstall the required packages:
pip install -r requirements.txtpip install torch transformers keybert pillow pytesseract PyPDF2 pdfplumber python-docxUse the following command to run the application:
python main.pyInstall Tesseract OCR:
Download from UB-Mannheim/tesseract.
UB-Mannheim/tesseract
Add Tesseract to your system PATH (e.g., C:\Program Files\Tesseract-OCR\tesseract.exe).
Here's a step-by-step guide to package your AI Files Renamer (Namemind AI) as standalone Windows software that users can download and install without needing Python or technical setup:
Ensure your code:
- Uses relative paths (no hardcoded
C:\Program Files) - Handles errors gracefully
- Includes all dependencies in the project folder
Use PyInstaller to package the Python code into a standalone .exe:
-
Install PyInstaller:
pip install pyinstaller
-
Create a
build.specfile:# build.spec block_cipher = None a = Analysis( ['main.py'], pathex=[], binaries=[], datas=[ ('utils.py', '.'), ('content_extractor.py', '.'), ('filename_generator.py', '.') ], hiddenimports=[ 'transformers.models.vit', 'torch', 'pytesseract', 'docx', 'pdfplumber' ], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False, ) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE( pyz, a.scripts, a.binaries, a.zipfiles, a.datas, [], name='AI_Renamer', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=False, # Set to True for debugging icon='icon.ico' # Optional: Add an icon file )
-
Build the executable:
pyinstaller build.spec
-
Download the portable Tesseract OCR for Windows:
- UB-Mannheim/tesseract (choose the
zipversion) - Extract it to
AI_Renamer/tesseract/
- UB-Mannheim/tesseract (choose the
-
Modify your code to use the local Tesseract:
# content_extractor.py pytesseract.pytesseract.tesseract_cmd = os.path.join( os.path.dirname(__file__), 'tesseract', 'tesseract.exe' )
Use Inno Setup to create a professional installer:
-
Download Inno Setup
-
Create an installer script
AI_Renamer.iss:[Setup] AppName=AI Renamer AppVersion=1.0 DefaultDirName={pf}\AI Renamer OutputDir=.\Output OutputBaseFilename=AI_Renamer_Setup Compression=lzma2 SolidCompression=yes SetupIconFile=icon.ico [Files] Source: "dist\AI_Renamer\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs Source: "tesseract\*"; DestDir: "{app}\tesseract"; Flags: ignoreversion recursesubdirs [Icons] Name: "{group}\AI Renamer"; Filename: "{app}\AI_Renamer.exe" Name: "{commondesktop}\AI Renamer"; Filename: "{app}\AI_Renamer.exe" [Run] Filename: "{app}\AI_Renamer.exe"; Description: "Launch AI Renamer"; Flags: postinstall nowait
-
Build the installer:
- Open
AI_Renamer.issin Inno Setup - Click "Build" → Output will be in
Output/folder
- Open
Handle Hugging Face models (they’ll auto-download on first run):
# filename_generator.py
from transformers import pipeline
def get_image_labels(image_path):
try:
# Models will auto-download to user's cache folder
image_classifier = pipeline("image-classification", model="google/vit-base-patch16-224")
result = image_classifier(image_path)
return [item['label'] for item in result[:3]]
except:
return []- Test on a fresh Windows machine without Python installed
- Verify:
- OCR works with bundled Tesseract
- AI models download automatically
- Files are renamed correctly
-
Upload to a file-sharing platform:
- GitHub Releases
- Google Drive/Dropbox
- SourceForge
-
Create a download page with:
- Installer file (
AI_Renamer_Setup.exe) - System requirements:
- Windows 10/11 - 4GB RAM (8GB recommended) - 500MB free disk space - Instructions for use
- Installer file (
Install PyInstaller if not done:
pip install pyinstallerCreate executable:
pyinstaller --onefile --windowed --icon=icon.ico main.pyThe EXE will be in dist/ folder
-
Code Signing:
-
Auto-Updates: Use
requeststo check for new versions:import requests def check_update(): try: response = requests.get("https://api.yourdomain.com/version") return response.json()['latest_version'] except: return None
-
Custom Branding:
- Add a splash screen
- Include a custom icon (
icon.ico)
AI_Renamer/
├── dist/ # PyInstaller output
├── tesseract/ # Bundled OCR engine
├── main.py # Main application
├── content_extractor.py
├── filename_generator.py
├── utils.py
├── build.spec
├── AI_Renamer.iss # Inno Setup script
└── icon.ico # Application icon
This approach ensures users get a single-click installer with all dependencies included. They won’t need Python or technical knowledge to use your AI Renamer! 🚀
.gif)