From b361fa72ecd27b8aed5ff429110cf06d1808d16b Mon Sep 17 00:00:00 2001 From: Jeffrey Morgan Date: Sun, 25 Jun 2023 13:08:03 -0400 Subject: [PATCH] reorganize directories --- .gitignore | 5 ++ README.md | 56 +++++++++++++++++- server/build.py => build.py | 3 +- {client => desktop}/.eslintrc.json | 0 {client => desktop}/.gitignore | 0 .prettierrc.json => desktop/.prettierrc.json | 0 {client => desktop}/forge.config.ts | 0 {client => desktop}/images/icon.icns | Bin {client => desktop}/package-lock.json | 0 {client => desktop}/package.json | 0 {client => desktop}/postcss.config.js | 0 {client => desktop}/src/app.css | 0 {client => desktop}/src/app.tsx | 0 {client => desktop}/src/index.html | 0 {client => desktop}/src/index.ts | 0 {client => desktop}/src/preload.ts | 0 {client => desktop}/src/renderer.tsx | 0 {client => desktop}/tailwind.config.js | 0 {client => desktop}/tsconfig.json | 0 {client => desktop}/webpack.main.config.ts | 0 {client => desktop}/webpack.plugins.ts | 0 .../webpack.renderer.config.ts | 0 {client => desktop}/webpack.rules.ts | 0 server/server.py => proto.py | 0 server/requirements.txt => requirements.txt | 0 server/.gitignore | 5 -- server/README.md | 39 ------------ 27 files changed, 59 insertions(+), 49 deletions(-) rename server/build.py => build.py (96%) rename {client => desktop}/.eslintrc.json (100%) rename {client => desktop}/.gitignore (100%) rename .prettierrc.json => desktop/.prettierrc.json (100%) rename {client => desktop}/forge.config.ts (100%) rename {client => desktop}/images/icon.icns (100%) rename {client => desktop}/package-lock.json (100%) rename {client => desktop}/package.json (100%) rename {client => desktop}/postcss.config.js (100%) rename {client => desktop}/src/app.css (100%) rename {client => desktop}/src/app.tsx (100%) rename {client => desktop}/src/index.html (100%) rename {client => desktop}/src/index.ts (100%) rename {client => desktop}/src/preload.ts (100%) rename {client => desktop}/src/renderer.tsx (100%) rename {client => desktop}/tailwind.config.js (100%) rename {client => desktop}/tsconfig.json (100%) rename {client => desktop}/webpack.main.config.ts (100%) rename {client => desktop}/webpack.plugins.ts (100%) rename {client => desktop}/webpack.renderer.config.ts (100%) rename {client => desktop}/webpack.rules.ts (100%) rename server/server.py => proto.py (100%) rename server/requirements.txt => requirements.txt (100%) delete mode 100644 server/.gitignore delete mode 100644 server/README.md diff --git a/.gitignore b/.gitignore index 94f1119e..aee3f423 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,7 @@ .DS_Store .vscode +.env +.venv +*.spec +build +dist diff --git a/README.md b/README.md index bc963120..65e0bd97 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,58 @@ -# Prototype +# proto -## Setup +🙊 + +## Running + +Install dependencies: ``` -brew install npm +pip install -r requirements.txt ``` +Put your model in `models/` and run: + +``` +python proto.py +``` + +To run the app: + +``` +cd desktop +npm install +npm start +``` + +## Building + +If using Apple silicon, you need a Python version that supports arm64: + +```bash +wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh +bash Miniforge3-MacOSX-arm64.sh +``` + +Get the dependencies: + +```bash +pip install -r requirements.txt +``` + +```bash +python3 build.py +``` + +Then to build the app: + +``` +cd desktop +npm run package +``` + +## API + +### `POST /generate` + +model: `string` - The name of the model to use in the `models` folder. +prompt: `string` - The prompt to use. diff --git a/server/build.py b/build.py similarity index 96% rename from server/build.py rename to build.py index f1fecafd..ec00ff9d 100644 --- a/server/build.py +++ b/build.py @@ -7,7 +7,7 @@ site_packages_dir = site.getsitepackages()[0] llama_cpp_dir = os.path.join(site_packages_dir, "llama_cpp") args = [ - "server.py", + "proto.py", "--paths", site_packages_dir, "--add-data", @@ -17,4 +17,3 @@ args = [ # generate the .spec file and run PyInstaller pyi_run(args) - diff --git a/client/.eslintrc.json b/desktop/.eslintrc.json similarity index 100% rename from client/.eslintrc.json rename to desktop/.eslintrc.json diff --git a/client/.gitignore b/desktop/.gitignore similarity index 100% rename from client/.gitignore rename to desktop/.gitignore diff --git a/.prettierrc.json b/desktop/.prettierrc.json similarity index 100% rename from .prettierrc.json rename to desktop/.prettierrc.json diff --git a/client/forge.config.ts b/desktop/forge.config.ts similarity index 100% rename from client/forge.config.ts rename to desktop/forge.config.ts diff --git a/client/images/icon.icns b/desktop/images/icon.icns similarity index 100% rename from client/images/icon.icns rename to desktop/images/icon.icns diff --git a/client/package-lock.json b/desktop/package-lock.json similarity index 100% rename from client/package-lock.json rename to desktop/package-lock.json diff --git a/client/package.json b/desktop/package.json similarity index 100% rename from client/package.json rename to desktop/package.json diff --git a/client/postcss.config.js b/desktop/postcss.config.js similarity index 100% rename from client/postcss.config.js rename to desktop/postcss.config.js diff --git a/client/src/app.css b/desktop/src/app.css similarity index 100% rename from client/src/app.css rename to desktop/src/app.css diff --git a/client/src/app.tsx b/desktop/src/app.tsx similarity index 100% rename from client/src/app.tsx rename to desktop/src/app.tsx diff --git a/client/src/index.html b/desktop/src/index.html similarity index 100% rename from client/src/index.html rename to desktop/src/index.html diff --git a/client/src/index.ts b/desktop/src/index.ts similarity index 100% rename from client/src/index.ts rename to desktop/src/index.ts diff --git a/client/src/preload.ts b/desktop/src/preload.ts similarity index 100% rename from client/src/preload.ts rename to desktop/src/preload.ts diff --git a/client/src/renderer.tsx b/desktop/src/renderer.tsx similarity index 100% rename from client/src/renderer.tsx rename to desktop/src/renderer.tsx diff --git a/client/tailwind.config.js b/desktop/tailwind.config.js similarity index 100% rename from client/tailwind.config.js rename to desktop/tailwind.config.js diff --git a/client/tsconfig.json b/desktop/tsconfig.json similarity index 100% rename from client/tsconfig.json rename to desktop/tsconfig.json diff --git a/client/webpack.main.config.ts b/desktop/webpack.main.config.ts similarity index 100% rename from client/webpack.main.config.ts rename to desktop/webpack.main.config.ts diff --git a/client/webpack.plugins.ts b/desktop/webpack.plugins.ts similarity index 100% rename from client/webpack.plugins.ts rename to desktop/webpack.plugins.ts diff --git a/client/webpack.renderer.config.ts b/desktop/webpack.renderer.config.ts similarity index 100% rename from client/webpack.renderer.config.ts rename to desktop/webpack.renderer.config.ts diff --git a/client/webpack.rules.ts b/desktop/webpack.rules.ts similarity index 100% rename from client/webpack.rules.ts rename to desktop/webpack.rules.ts diff --git a/server/server.py b/proto.py similarity index 100% rename from server/server.py rename to proto.py diff --git a/server/requirements.txt b/requirements.txt similarity index 100% rename from server/requirements.txt rename to requirements.txt diff --git a/server/.gitignore b/server/.gitignore deleted file mode 100644 index 1b1d3c68..00000000 --- a/server/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.env -.venv -*.spec -build -dist diff --git a/server/README.md b/server/README.md deleted file mode 100644 index ea9ba6c3..00000000 --- a/server/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Server - -🙊 - -## Installation - -If using Apple silicon, you need a Python version that supports arm64: - -```bash -wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-MacOSX-arm64.sh -bash Miniforge3-MacOSX-arm64.sh -``` - -Get the dependencies: - -```bash -pip install -r requirements.txt -``` - -## Building - -```bash -python3 build.py -``` - -## Running - -Put your model in `models/` and run: - -```bash -python server.py -``` - -## API - -### `POST /generate` - -model: `string` - The name of the model to use in the `models` folder. -prompt: `string` - The prompt to use.