Skip to content

Commit

Permalink
Minor updates to piper voice, ingnoring env files, and updating the e…
Browse files Browse the repository at this point in the history
…xample docker compose file

Remove unused import
  • Loading branch information
allen-n committed Nov 14, 2024
1 parent c244dbb commit a1745ad
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 60 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ scripts/

# Models
piper_models/*

# Env files
.env
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ RUN pip install --no-cache-dir -r requirements.txt
WORKDIR /app

# Set this as the default command
ENTRYPOINT [ "python", "/app_src/main.py" ]
# ENTRYPOINT [ "python", "/app_src/main.py" ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from math import e
import os
import asyncio
import logging
Expand Down Expand Up @@ -128,14 +127,10 @@ async def chunkify(self) -> AudioSegment:
)
estimated_remaining_time_m = total_seconds_remaining // 60
estimated_remaining_time_s = total_seconds_remaining % 60
print(
logger.info(
f"Processed {len(results)} of {len(tasks)} chunks in chapter. Estimated time remaining for chapter: {round(estimated_remaining_time_m)} min, {round(estimated_remaining_time_s)} sec",
end="\r",
flush=True,
)

# results = await asyncio.gather(*tasks, return_exceptions=True)

audio_segments = []
# Collect results and reconstruct the audio segments in order
results_dict = {}
Expand Down
42 changes: 42 additions & 0 deletions docker-compose.piper-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
services:
piper:
image: lscr.io/linuxserver/piper:latest
container_name: piper
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- PIPER_VOICE=en_US-hfc_male-medium
- PIPER_LENGTH=1.0 # optional
- PIPER_NOISE=0.667 # optional
- PIPER_NOISEW=0.333 # optional
- PIPER_SPEAKER=0 # optional
- PIPER_PROCS=1 # optional
volumes:
# - /path/to/piper/data:/config # Optional volume for Piper config
- ./piper_models:/usr/share/piper_models # Volume for Piper models, find models at https://github.com/rhasspy/piper/
ports:
- 10200:10200
restart: unless-stopped
healthcheck:
test: ['CMD-SHELL', 'nc -z localhost 10200']
interval: 10s
timeout: 5s
retries: 5

epub_to_audiobook:
build:
context: ./ # Directory containing the Dockerfile for epub_to_audiobook
dockerfile: Dockerfile # Name of the Dockerfile (if it's not the default 'Dockerfile')
container_name: epub_to_audiobook
environment:
- PIPER_HOST=piper
- PIPER_PORT=10200
volumes:
- ./:/app
- <path/to/epub/dir/on/host>:/epub_src # Map the top level epub directory on the host machine
# command: tail -f /dev/null # Uncomment this line to keep the container running, and run via connecting to it with `docker exec -it epub_to_audiobook /bin/bash`
command: "python main.py --tts piper_docker --no_prompt '/epub_src/<path/to/epub/file>' audiobook_output" # Run command directly when the containers start up
depends_on:
piper:
condition: service_healthy
48 changes: 0 additions & 48 deletions docker-compose.yml

This file was deleted.

5 changes: 0 additions & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,5 @@ openai==1.35.7
requests==2.32.3
socksio==1.0.0
edge-tts==6.1.12
<<<<<<< HEAD
pydub==0.25.1
=======
pydub==0.25.1
python-dotenv==1.0.1
wyoming==1.6.0
>>>>>>> 4679f9c (Init commit of local piper docker compose container)

0 comments on commit a1745ad

Please sign in to comment.