Skip to content

Commit c437abb

Browse files
committed
+ optional disable local ollama
1 parent 691027d commit c437abb

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
SHELL := /bin/bash
22

33
export DISABLE_VENV ?= 0
4-
export DISABLE_OLLAMA ?= 0
4+
export DISABLE_LOCAL_OLLAMA ?= 0
5+
56

67
.PHONY: help
78
help:
@@ -82,7 +83,7 @@ install-requirements:
8283
.PHONY: run
8384
run:
8485
@echo "Starting the local application server..."; \
85-
DISABLE_VENV=${DISABLE_VENV:-0} DISABLE_OLLAMA=${DISABLE_OLLAMA:-0} ./run.sh
86+
DISABLE_VENV=$(DISABLE_VENV) DISABLE_LOCAL_OLLAMA=$(DISABLE_LOCAL_OLLAMA) ./run.sh
8687

8788
.PHONY: setup-docker
8889
setup-docker:

README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,24 @@ To have it up and running please execute the following steps:
5252
[Download and install Ollama](https://ollama.com/download)
5353
[Download and install Docker](https://www.docker.com/products/docker-desktop/)
5454

55+
> ### Setting Up Ollama on a Remote Host
56+
>
57+
> To connect to an external Ollama instance, set the environment variable: `OLLAMA_HOST=http://address:port`, e.g.:
58+
> ```bash
59+
> OLLAMA_HOST=http(s)://127.0.0.1:5000
60+
> ```
61+
>
62+
> If you want to disable the local Ollama model, use env `DISABLE_LOCAL_OLLAMA=1`, e.g.
63+
> ```bash
64+
> DISABLE_LOCAL_OLLAMA=1 make install
65+
> ```
66+
> **Note**: When local Ollama is disabled, ensure the required model is downloaded on the external instance.
67+
>
68+
> Currently, the `DISABLE_LOCAL_OLLAMA` variable cannot be used to disable Ollama in Docker. As a workaround, remove the `ollama` service from `docker-compose.yml` or `docker-compose.gpu.yml`.
69+
>
70+
> Support for using the variable in Docker environments will be added in a future release.
71+
72+
5573
### Clone the Repository
5674
5775
First, clone the repository and change current directory to it:
@@ -170,7 +188,7 @@ Then modify the variables inside the file:
170188
```bash
171189
#APP_ENV=production # sets the app into prod mode, otherwise dev mode with auto-reload on code changes
172190
REDIS_CACHE_URL=redis://localhost:6379/1
173-
STORAGE_PROFILE_PATH=/storage_profiles
191+
STORAGE_PROFILE_PATH=./storage_profiles
174192
LLAMA_VISION_PROMPT="You are OCR. Convert image to markdown."
175193
176194
# CLI settings
@@ -283,7 +301,7 @@ python client/cli.py ocr_upload --file examples/example-mri.pdf --ocr_cache --pr
283301
```
284302
285303
The `ocr` command can store the results using the `storage_profiles`:
286-
- **storage_profile**: Used to save the result - the `default` profile (`/storage_profiles/default.yaml`) is used by default; if empty file is not saved
304+
- **storage_profile**: Used to save the result - the `default` profile (`./storage_profiles/default.yaml`) is used by default; if empty file is not saved
287305
- **storage_filename**: Outputting filename - relative path of the `root_path` set in the storage profile - by default a relative path to `/storage` folder; can use placeholders for dynamic formatting: `{file_name}`, `{file_extension}`, `{Y}`, `{mm}`, `{dd}` - for date formatting, `{HH}`, `{MM}`, `{SS}` - for time formatting
288306
289307
@@ -381,7 +399,7 @@ apiClient.uploadFile(formData).then(response => {
381399
- **ocr_cache**: Whether to cache the OCR result (true or false).
382400
- **prompt**: When provided, will be used for Ollama processing the OCR result
383401
- **model**: When provided along with the prompt - this model will be used for LLM processing
384-
- **storage_profile**: Used to save the result - the `default` profile (`/storage_profiles/default.yaml`) is used by default; if empty file is not saved
402+
- **storage_profile**: Used to save the result - the `default` profile (`./storage_profiles/default.yaml`) is used by default; if empty file is not saved
385403
- **storage_filename**: Outputting filename - relative path of the `root_path` set in the storage profile - by default a relative path to `/storage` folder; can use placeholders for dynamic formatting: `{file_name}`, `{file_extension}`, `{Y}`, `{mm}`, `{dd}` - for date formatting, `{HH}`, `{MM}`, `{SS}` - for time formatting
386404
387405
Example:

run.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#!/bin/bash
22

3+
echo "$DISABLE_LOCAL_OLLAMA"
4+
35
DISABLE_VENV="${DISABLE_VENV:-0}"
4-
DISABLE_OLLAMA="${DISABLE_OLLAMA:-0}"
6+
DISABLE_LOCAL_OLLAMA="${DISABLE_LOCAL_OLLAMA:-0}"
57

68
RED='\033[0;31m'
79
CYAN='\033[0;36m'
@@ -31,8 +33,9 @@ fi
3133

3234
set -a; source .env.localhost; set +a
3335

34-
if [ "$DISABLE_OLLAMA" -eq 1 ]; then
35-
echo "Ollama disabled by DISABLE_OLLAMA"
36+
if [ "$DISABLE_LOCAL_OLLAMA" -eq 1 ]; then
37+
echo "Local Ollama disabled by env \`DISABLE_LOCAL_OLLAMA=$DISABLE_LOCAL_OLLAMA\`"
38+
echo "External Ollama should be listening on OLLAMA_HOST={$OLLAMA_HOST}"
3639
else
3740
echo "Starting Ollama Server"
3841
ollama serve &

0 commit comments

Comments
 (0)