Skip to content

Commit 78b928f

Browse files
committed
Add user interface
1 parent 1bb15fb commit 78b928f

File tree

5 files changed

+605
-13
lines changed

5 files changed

+605
-13
lines changed

docker-compose-gpu.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ services:
3434
environment:
3535
- RESTART_IF_NO_GPU=$RESTART_IF_NO_GPU
3636
- OLLAMA_HOST=http://localhost:11434
37+
networks:
38+
- pdf-analysis-network
3739

3840
pdf-document-layout-analysis-gpu-translation:
3941
container_name: pdf-document-layout-analysis-gpu-translation
@@ -61,6 +63,43 @@ services:
6163
networks:
6264
- pdf-analysis-network
6365

66+
pdf-document-layout-analysis-gui-gpu:
67+
container_name: pdf-document-layout-analysis-gui-gpu
68+
entrypoint: [ "python", "./src/gradio_app.py" ]
69+
init: true
70+
restart: unless-stopped
71+
build:
72+
context: .
73+
dockerfile: Dockerfile
74+
ports:
75+
- "7860:7860"
76+
depends_on:
77+
- pdf-document-layout-analysis-gpu
78+
environment:
79+
- API_BASE_URL=http://pdf-document-layout-analysis-gpu:5060
80+
networks:
81+
- pdf-analysis-network
82+
83+
pdf-document-layout-analysis-gui-gpu-translation:
84+
container_name: pdf-document-layout-analysis-gui-gpu-translation
85+
entrypoint: [ "python", "./src/gradio_app.py" ]
86+
init: true
87+
restart: unless-stopped
88+
build:
89+
context: .
90+
dockerfile: Dockerfile
91+
ports:
92+
- "7860:7860"
93+
depends_on:
94+
ollama-gpu:
95+
condition: service_healthy
96+
pdf-document-layout-analysis-gpu-translation:
97+
condition: service_started
98+
environment:
99+
- API_BASE_URL=http://pdf-document-layout-analysis-gpu-translation:5060
100+
networks:
101+
- pdf-analysis-network
102+
64103
networks:
65104
pdf-analysis-network:
66105
driver: bridge

docker-compose.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ services:
2828
- "5060:5060"
2929
environment:
3030
- OLLAMA_HOST=http://localhost:11434
31+
networks:
32+
- pdf-analysis-network
3133

3234
pdf-document-layout-analysis-translation:
3335
container_name: pdf-document-layout-analysis-translation
@@ -47,6 +49,43 @@ services:
4749
networks:
4850
- pdf-analysis-network
4951

52+
pdf-document-layout-analysis-gui:
53+
container_name: pdf-document-layout-analysis-gui
54+
entrypoint: [ "python", "./src/gradio_app.py" ]
55+
init: true
56+
restart: unless-stopped
57+
build:
58+
context: .
59+
dockerfile: Dockerfile
60+
ports:
61+
- "7860:7860"
62+
depends_on:
63+
- pdf-document-layout-analysis
64+
environment:
65+
- API_BASE_URL=http://pdf-document-layout-analysis:5060
66+
networks:
67+
- pdf-analysis-network
68+
69+
pdf-document-layout-analysis-gui-translation:
70+
container_name: pdf-document-layout-analysis-gui-translation
71+
entrypoint: [ "python", "./src/gradio_app.py" ]
72+
init: true
73+
restart: unless-stopped
74+
build:
75+
context: .
76+
dockerfile: Dockerfile
77+
ports:
78+
- "7860:7860"
79+
depends_on:
80+
ollama:
81+
condition: service_healthy
82+
pdf-document-layout-analysis-translation:
83+
condition: service_started
84+
environment:
85+
- API_BASE_URL=http://pdf-document-layout-analysis-translation:5060
86+
networks:
87+
- pdf-analysis-network
88+
5089
networks:
5190
pdf-analysis-network:
5291
driver: bridge

justfile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ HAS_GPU := `command -v nvidia-smi > /dev/null && echo 1 || echo 0`
33
help:
44
@echo "PDF Document Layout Analysis - Available Commands:"
55
@echo ""
6-
@echo "📄 Standard PDF Analysis (main app only):"
7-
@echo " just start - Auto-detects GPU, starts main app only"
8-
@echo " just start_no_gpu - Forces CPU mode, starts main app only"
9-
@echo " just start_detached - Background mode, main app only (CPU)"
10-
@echo " just start_detached_gpu - Background mode, main app only (GPU)"
6+
@echo "📄 Standard PDF Analysis (API + Gradio UI):"
7+
@echo " just start - Auto-detects GPU, starts API and UI"
8+
@echo " just start_no_gpu - Forces CPU mode, starts API and UI"
9+
@echo " just start_detached - Background mode, API only (CPU)"
10+
@echo " just start_detached_gpu - Background mode, API only (GPU)"
1111
@echo ""
12-
@echo "🌐 With Translation Features (includes Ollama):"
12+
@echo "🌐 With Translation Features (API + UI + Ollama):"
1313
@echo " just start_translation - Auto-detects GPU, includes Ollama"
1414
@echo " just start_translation_no_gpu - Forces CPU mode, includes Ollama"
1515
@echo ""
@@ -28,7 +28,7 @@ help:
2828
@echo " just remove_docker_images - Remove Docker images"
2929
@echo " just free_up_space - Free up system space"
3030
@echo ""
31-
@echo "💡 Tip: Use 'just start' for basic PDF analysis, 'just start_translation' for translation features"
31+
@echo "💡 Tip: 'just start' launches both API (port 5060) and UI (port 7860)"
3232

3333
install:
3434
. .venv/bin/activate; pip install -Ur requirements.txt
@@ -57,16 +57,16 @@ start:
5757
mkdir -p ./models
5858
if [ {{HAS_GPU}} -eq 1 ]; then \
5959
echo "NVIDIA GPU detected, using docker-compose-gpu.yml"; \
60-
docker compose -f docker-compose-gpu.yml up --build pdf-document-layout-analysis-gpu; \
60+
docker compose -f docker-compose-gpu.yml up --build pdf-document-layout-analysis-gpu pdf-document-layout-analysis-gui-gpu; \
6161
else \
6262
echo "No NVIDIA GPU detected, using docker-compose.yml"; \
63-
docker compose -f docker-compose.yml up --build pdf-document-layout-analysis; \
63+
docker compose -f docker-compose.yml up --build pdf-document-layout-analysis pdf-document-layout-analysis-gui; \
6464
fi
6565

6666
start_no_gpu:
6767
mkdir -p ./models
6868
@echo "Starting with CPU-only configuration"
69-
docker compose up --build pdf-document-layout-analysis
69+
docker compose up --build pdf-document-layout-analysis pdf-document-layout-analysis-gui
7070

7171
start_translation:
7272
#!/bin/bash
@@ -90,7 +90,7 @@ start_translation:
9090
echo "Warning: Ollama GPU container may not be fully healthy yet, but continuing..."
9191
fi
9292
echo "Starting all services with translation support..."
93-
docker compose -f docker-compose-gpu.yml up --build pdf-document-layout-analysis-gpu-translation
93+
docker compose -f docker-compose-gpu.yml up --build pdf-document-layout-analysis-gpu-translation pdf-document-layout-analysis-gui-gpu-translation
9494
else
9595
echo "No NVIDIA GPU detected, starting with translation support (CPU Ollama)"
9696
echo "Starting Ollama container first..."
@@ -110,7 +110,7 @@ start_translation:
110110
echo "Warning: Ollama container may not be fully healthy yet, but continuing..."
111111
fi
112112
echo "Starting all services with translation support..."
113-
docker compose -f docker-compose.yml up --build pdf-document-layout-analysis-translation
113+
docker compose -f docker-compose.yml up --build pdf-document-layout-analysis-translation pdf-document-layout-analysis-gui-translation
114114
fi
115115

116116
start_translation_no_gpu:
@@ -134,7 +134,7 @@ start_translation_no_gpu:
134134
echo "Warning: Ollama container may not be fully healthy yet, but continuing..."
135135
fi
136136
echo "Starting all services with translation support..."
137-
docker compose up --build pdf-document-layout-analysis-translation
137+
docker compose up --build pdf-document-layout-analysis-translation pdf-document-layout-analysis-gui-translation
138138

139139
stop:
140140
docker compose stop

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ latex2mathml==3.78.0
2626
PyMuPDF==1.25.5
2727
ollama==0.6.0
2828
cachetools==6.2.1
29+
gradio==4.40.0
2930
git+https://github.com/huridocs/pdf-features.git@2025.10.16.3

0 commit comments

Comments
 (0)