build server executable
This commit is contained in:
parent
32c6d8e6cc
commit
f0eee3faa0
4 changed files with 31 additions and 1 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -1,2 +1,5 @@
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.vscode
|
.vscode
|
||||||
|
*.spec
|
||||||
|
*/build
|
||||||
|
*/dist
|
|
@ -18,6 +18,12 @@ pip install llama-cpp-python
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 build.py
|
||||||
|
```
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
Put your model in `models/` and run:
|
Put your model in `models/` and run:
|
||||||
|
|
20
server/build.py
Normal file
20
server/build.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import site
|
||||||
|
import os
|
||||||
|
from PyInstaller.__main__ import run as pyi_run
|
||||||
|
|
||||||
|
# Get the directory of site-packages and llama_cpp
|
||||||
|
site_packages_dir = site.getsitepackages()[0]
|
||||||
|
llama_cpp_dir = os.path.join(site_packages_dir, "llama_cpp")
|
||||||
|
|
||||||
|
# Prepare the arguments for PyInstaller
|
||||||
|
args = [
|
||||||
|
"server.py",
|
||||||
|
"--paths",
|
||||||
|
site_packages_dir,
|
||||||
|
"--add-data",
|
||||||
|
f"{llama_cpp_dir}{os.pathsep}llama_cpp",
|
||||||
|
"--onefile",
|
||||||
|
]
|
||||||
|
|
||||||
|
# Generate the .spec file and run PyInstaller
|
||||||
|
pyi_run(args)
|
|
@ -1,2 +1,3 @@
|
||||||
Flask==2.3.2
|
Flask==2.3.2
|
||||||
flask_cors==3.0.10
|
flask_cors==3.0.10
|
||||||
|
llama-cpp-python==0.1.65
|
Loading…
Reference in a new issue