-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_exe.py
More file actions
71 lines (63 loc) · 2.33 KB
/
build_exe.py
File metadata and controls
71 lines (63 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
"""
NeonAI — PyInstaller Build Script
Creates a single-folder distribution with NeonAI.exe
"""
import subprocess
import sys
import os
def build():
base_dir = os.path.dirname(os.path.abspath(__file__))
cmd = [
sys.executable, "-m", "PyInstaller",
"--name", "NeonAI",
"--noconfirm",
"--clean",
# Include templates and static files
"--add-data", f"{os.path.join(base_dir, 'templates')};templates",
"--add-data", f"{os.path.join(base_dir, 'static')};static",
# Include all Python modules
"--add-data", f"{os.path.join(base_dir, 'brain')};brain",
"--add-data", f"{os.path.join(base_dir, 'models')};models",
"--add-data", f"{os.path.join(base_dir, 'tools')};tools",
"--add-data", f"{os.path.join(base_dir, 'utils')};utils",
"--add-data", f"{os.path.join(base_dir, 'web')};web",
"--add-data", f"{os.path.join(base_dir, 'voice')};voice",
"--add-data", f"{os.path.join(base_dir, 'exam')};exam",
"--add-data", f"{os.path.join(base_dir, 'movie')};movie",
# Hidden imports Flask needs
"--hidden-import", "flask",
"--hidden-import", "flask_cors",
"--hidden-import", "werkzeug",
"--hidden-import", "jinja2",
"--hidden-import", "requests",
"--hidden-import", "pyngrok",
"--hidden-import", "sqlite3",
# Console mode (shows server logs)
"--console",
# Entry point
os.path.join(base_dir, "server.py"),
]
print("=" * 50)
print(" NeonAI — Building EXE")
print("=" * 50)
print()
print("NOTE: Ollama must be installed separately on the target machine.")
print(" The EXE bundles the Flask server + all NeonAI code.")
print()
result = subprocess.run(cmd, cwd=base_dir)
if result.returncode == 0:
print()
print("=" * 50)
print(" BUILD SUCCESSFUL!")
print(f" Output: {os.path.join(base_dir, 'dist', 'NeonAI')}")
print("=" * 50)
print()
print("To distribute:")
print("1. Zip the 'dist/NeonAI' folder")
print("2. Share the zip file")
print("3. User extracts and runs NeonAI.exe")
print("4. User needs Ollama installed (ollama.com)")
else:
print("BUILD FAILED. Check errors above.")
if __name__ == "__main__":
build()