Skip to content

Commit

Permalink
Added docker build and run targets to the makefile, plus Dockerfile and
Browse files Browse the repository at this point in the history
Docker ignore, plus updated the README a little.
  • Loading branch information
FergusFettes committed Feb 25, 2023
1 parent e08100d commit 203b5f2
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 7 deletions.
24 changes: 24 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Standard
__pycache__
*.pyc
*.pyo
*.pyd
.Python
env
pip-log.txt
pip-delete-this-directory.txt
.tox
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.log
.git
.mypy_cache
.pytest_cache
.hypothesis

# Custom
data/
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,6 @@ atlassian-ide-plugin.xml
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
fabric.properties

.tags
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.10-slim

RUN apt-get update && apt-get install -y python3-tk && pip install --upgrade pip

WORKDIR /app

COPY . ./

RUN pip install -r requirements.txt

CMD ["python", "main.py"]
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
OPENAI_API_KEY := <your key here>
GOOSEAI_API_KEY := <your key here (you only need one of these)>
AI21_API_KEY := <your key here>


IMAGE := loom

SHELL = /bin/sh

CURRENT_UID := $(shell id -u)
CURRENT_GID := $(shell id -g)

export CURRENT_UID
export CURRENT_GID

install:
echo "Make sure you are using python version 3.9.13 or over"
sudo apt install python-tk

build:
docker build -t $(IMAGE) .

run:
docker run -it --rm \
-v $(PWD)/data:/app/data \
-v $(PWD)/examples:/app/examples \
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
-e DISPLAY=$(DISPLAY) \
-u=$(CURRENT_UID):$(CURRENT_GID) \
$(IMAGE)
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,30 @@ Reset zoom: `Control-0`

# Instructions

## Python

0. Make sure you have tkinter installed

```sudo apt-get install python3-tk```
1. Setup your python env (should be >= 3.9.13)

```python3 -m venv env```
```source env/bin/activate```
1. Install requirements

```pip install -r requirements.txt```
2. Set environmental variables for `OPENAI_API_KEY`, `GOOSEAI_API_KEY`, `AI21_API_KEY`
2. [Optional] Set environmental variables for `OPENAI_API_KEY`, `GOOSEAI_API_KEY`, `AI21_API_KEY` (you can also use the settings options)

```export OPENAI_API_KEY={your api key}```
3. Run main.py
4. Load a json tree
5. Read :)

## Docker

(Only tested on Linux.)

0. [Optional] Edit the Makefile with your API keys (you can also use the settings options)
1. Run the make targets

```make build run```
9 changes: 4 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
tokenizers>=0.13.2
transformers>=4.26.1
amqp==5.0.2
billiard==3.6.3.0
celery==5.0.5
Expand All @@ -13,12 +15,10 @@ idna==2.10
jsonlines==2.0.0
kombu==5.0.2
multiprocess==0.70.11.1
numexpr==2.7.1
numpy==1.21.2
openai
openai>=0.26.5
pandas==1.3.3
pathos==0.2.7
Pillow==8.0.1
pillow>=9.4.0
pox==0.2.9
ppft==1.6.6.3
prompt-toolkit==3.0.8
Expand All @@ -33,6 +33,5 @@ ttkthemes==2.4.0
urllib3==1.26.2
vine==5.0.0
wcwidth==0.2.5
transformers==4.2.2
deepmerge==0.3.0
diff-match-patch==20200713

0 comments on commit 203b5f2

Please sign in to comment.