Skip to content

Commit f26e1fb

Browse files
committed
update readme and services.py
1 parent 430781c commit f26e1fb

2 files changed

Lines changed: 40 additions & 23 deletions

File tree

extras/speaker-recognition/README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,27 @@ This generates SSL certificates and configures nginx for your IP address.
4242

4343
### 4. Start the system
4444
```bash
45-
docker-compose up --build -d
45+
# For CPU-only
46+
docker compose --profile cpu up --build -d
47+
48+
# For GPU acceleration
49+
docker compose --profile gpu up --build -d
4650
```
4751

4852
This starts three services:
4953
- **FastAPI backend** on port 8085 (internal API service)
5054
- **React web UI** on port configured by REACT_UI_PORT (defaults vary by mode)
5155
- **Nginx proxy** on ports 8444 (HTTPS) and 8081 (HTTP redirect)
5256

57+
**⚠️ Important**: Use the same profile when stopping:
58+
```bash
59+
# Stop CPU services
60+
docker compose --profile cpu down
61+
62+
# Stop GPU services
63+
docker compose --profile gpu down
64+
```
65+
5366
### 5. Access the Web UI
5467

5568
**HTTPS Mode (Recommended for microphone access):**
@@ -371,11 +384,11 @@ The React UI is configured with HTTPS enabled by default (`REACT_UI_HTTPS=true`)
371384
## 🚨 Troubleshooting
372385

373386
**Can't access the web UI?**
374-
- Check if services are running: `docker-compose ps`
375-
- View logs: `docker-compose logs web-ui`
387+
- Check if services are running: `docker compose --profile cpu ps` (or `--profile gpu`)
388+
- View logs: `docker compose --profile cpu logs web-ui`
376389

377390
**Speaker service not responding?**
378-
- Check backend logs: `docker-compose logs speaker-service`
391+
- Check backend logs: `docker compose --profile cpu logs speaker-service`
379392
- Verify HF_TOKEN is set correctly
380393

381394
**Models not downloading?**
@@ -795,7 +808,7 @@ pip install pyaudio
795808

796809
```bash
797810
# Start the speaker service first
798-
docker-compose up -d
811+
docker compose --profile cpu up -d
799812

800813
# Enroll a new speaker (records 10 seconds)
801814
python laptop_client.py enroll --speaker-id "john" --speaker-name "John Doe" --duration 10

services.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,35 @@ def run_compose_command(service_name, command, build=False):
7272
cmd = ['docker', 'compose']
7373

7474
# Handle speaker-recognition service specially
75-
if service_name == 'speaker-recognition' and command == 'up':
76-
# Read configuration to determine how to start
75+
if service_name == 'speaker-recognition' and command in ['up', 'down']:
76+
# Read configuration to determine profile
7777
env_file = service_path / '.env'
7878
if env_file.exists():
7979
env_values = dotenv_values(env_file)
8080
compute_mode = env_values.get('COMPUTE_MODE', 'cpu')
81-
https_enabled = env_values.get('REACT_UI_HTTPS', 'false')
82-
83-
if https_enabled.lower() == 'true':
84-
# HTTPS mode: start with profile for all services (includes nginx)
85-
if compute_mode == 'gpu':
86-
cmd.extend(['--profile', 'gpu'])
87-
else:
88-
cmd.extend(['--profile', 'cpu'])
89-
cmd.extend(['up', '-d'])
81+
82+
# Add profile flag for both up and down commands
83+
if compute_mode == 'gpu':
84+
cmd.extend(['--profile', 'gpu'])
9085
else:
91-
# HTTP mode: start specific services with profile (no nginx)
92-
if compute_mode == 'gpu':
93-
cmd.extend(['--profile', 'gpu'])
86+
cmd.extend(['--profile', 'cpu'])
87+
88+
if command == 'up':
89+
https_enabled = env_values.get('REACT_UI_HTTPS', 'false')
90+
if https_enabled.lower() == 'true':
91+
# HTTPS mode: start with profile for all services (includes nginx)
92+
cmd.extend(['up', '-d'])
9493
else:
95-
cmd.extend(['--profile', 'cpu'])
96-
cmd.extend(['up', '-d', 'speaker-service-gpu' if compute_mode == 'gpu' else 'speaker-service-cpu', 'web-ui'])
94+
# HTTP mode: start specific services with profile (no nginx)
95+
cmd.extend(['up', '-d', 'speaker-service-gpu' if compute_mode == 'gpu' else 'speaker-service-cpu', 'web-ui'])
96+
elif command == 'down':
97+
cmd.extend(['down'])
9798
else:
98-
# Fallback: just start base service
99-
cmd.extend(['up', '-d'])
99+
# Fallback: no profile
100+
if command == 'up':
101+
cmd.extend(['up', '-d'])
102+
elif command == 'down':
103+
cmd.extend(['down'])
100104
else:
101105
# Standard compose commands for other services
102106
if command == 'up':

0 commit comments

Comments
 (0)