From f989731c089875841dc2dd62c051e61c1b31311d Mon Sep 17 00:00:00 2001 From: Ben Xu Date: Mon, 30 Dec 2024 19:54:49 -0500 Subject: [PATCH] move tts and stt to 9001 and 9002 --- docs/server/configure.mdx | 4 ++-- software/main.py | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/docs/server/configure.mdx b/docs/server/configure.mdx index 735c05b..18fc971 100644 --- a/docs/server/configure.mdx +++ b/docs/server/configure.mdx @@ -129,7 +129,7 @@ We recommend having Docker installed for the easiest setup. Local TTS and STT re #### Local TTS 1. Clone the [openedai-speech](https://github.com/matatonic/openedai-speech?tab=readme-ov-file) repository -2. Follow the Docker Image instructions for your system. Default run `docker compose -f docker-compose.min.yml up` in the root. +2. Follow the Docker Image instructions for your system. Default run `docker compose -f docker-compose.min.yml up --publish 9001:8000` in the root. 3. Set your profile with local TTS service ```python interpreter.tts = "local" @@ -138,7 +138,7 @@ interpreter.tts = "local" #### Local STT 1. Clone the [faster-whisper-server](https://github.com/fedirz/faster-whisper-server) repository 2. Follow the Docker Compose Quick Start instructions for your respective system. -3. Run `docker run --publish 8001:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER__MODEL=Systran/faster-whisper-small --detach fedirz/faster-whisper-server:latest-cpu` to publish to port 8001 instead of the default 8000 (since our TTS uses this port). +3. Run `docker run --publish 9002:8000 --volume ~/.cache/huggingface:/root/.cache/huggingface --env WHISPER__MODEL=Systran/faster-whisper-small --detach fedirz/faster-whisper-server:latest-cpu` to publish to port 8001 instead of the default 8000 (since our TTS uses this port). 4. Set your profile with local STT service ```python interpreter.stt = "local" diff --git a/software/main.py b/software/main.py index b5a3dca..c635afd 100644 --- a/software/main.py +++ b/software/main.py @@ -180,16 +180,22 @@ def run( threads.append(server_thread) if server == "livekit": - + ### LIVEKIT SERVER def run_command(command): + i = 0 while True: - process = subprocess.run(command, shell=True, check=True, preexec_fn=os.setsid) + print("i is: ", i) + if i > 0: + process = subprocess.run(command, shell=True, check=True, preexec_fn=os.setsid) + else: + print("Skipping server start (first iteration)") url = f"http://{server_host}:{server_port}" while True: time.sleep(5) try: + print("Checking server status... with i = ", i) response = requests.get(url) if response.status_code == 200: continue @@ -201,10 +207,14 @@ def run( break print("Server failed to start, retrying...") + try: - os.killpg(os.getpgid(process.pid), signal.SIGTERM) + os.killpg(os.getpgid(process.pid), signal.SIGTERM) # This will fail when i=0 except ProcessLookupError: - pass # Process group already terminated + pass + + i += 1 + # Start the livekit server if debug: