package server with client

This commit is contained in:
Bruce MacDonald
2023-06-23 18:38:22 -04:00
parent f0eee3faa0
commit c5bafaff54
8 changed files with 183 additions and 5 deletions

View File

@@ -1,12 +1,12 @@
import site
import os
import shutil
from PyInstaller.__main__ import run as pyi_run
# Get the directory of site-packages and llama_cpp
# the llama_cpp directory is not included if not explicitly added
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",
@@ -16,5 +16,7 @@ args = [
"--onefile",
]
# Generate the .spec file and run PyInstaller
# generate the .spec file and run PyInstaller
pyi_run(args)
shutil.copy2("dist/server", "../client/resources/server")

View File

@@ -2,7 +2,7 @@ import json
import os
from llama_cpp import Llama
from flask import Flask, Response, stream_with_context, request
from flask_cors import CORS, cross_origin
from flask_cors import CORS
app = Flask(__name__)
CORS(app) # enable CORS for all routes