move tts and stt to 9001 and 9002

pull/314/head
Ben Xu 4 weeks ago
parent 0c6a2cde30
commit f989731c08

@ -129,7 +129,7 @@ We recommend having Docker installed for the easiest setup. Local TTS and STT re
#### Local TTS #### Local TTS
1. Clone the [openedai-speech](https://github.com/matatonic/openedai-speech?tab=readme-ov-file) repository 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 3. Set your profile with local TTS service
```python ```python
interpreter.tts = "local" interpreter.tts = "local"
@ -138,7 +138,7 @@ interpreter.tts = "local"
#### Local STT #### Local STT
1. Clone the [faster-whisper-server](https://github.com/fedirz/faster-whisper-server) repository 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. 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 4. Set your profile with local STT service
```python ```python
interpreter.stt = "local" interpreter.stt = "local"

@ -183,13 +183,19 @@ def run(
### LIVEKIT SERVER ### LIVEKIT SERVER
def run_command(command): def run_command(command):
i = 0
while True: while True:
print("i is: ", i)
if i > 0:
process = subprocess.run(command, shell=True, check=True, preexec_fn=os.setsid) 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}" url = f"http://{server_host}:{server_port}"
while True: while True:
time.sleep(5) time.sleep(5)
try: try:
print("Checking server status... with i = ", i)
response = requests.get(url) response = requests.get(url)
if response.status_code == 200: if response.status_code == 200:
continue continue
@ -201,10 +207,14 @@ def run(
break break
print("Server failed to start, retrying...") print("Server failed to start, retrying...")
try: 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: except ProcessLookupError:
pass # Process group already terminated pass
i += 1
# Start the livekit server # Start the livekit server
if debug: if debug:

Loading…
Cancel
Save