diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9a14809 --- /dev/null +++ b/Makefile @@ -0,0 +1,82 @@ +# Raccoon Mission: OpenedAI Speech Development Makefile +# Deploy to ai.foxhop.net server with ease + +REMOTE_HOST = ai.foxhop.net +REMOTE_USER = fox +REMOTE_PATH = ~/openedai-speech-fresh +CONTAINER_NAME = openedai-speech-fresh-server-1 + +.PHONY: help deploy sync restart logs test clean stop start voices + +help: + @echo "๐Ÿฆ Raccoon TTS Mission - Development Commands" + @echo "" + @echo "Deployment:" + @echo " make deploy - Full deploy: sync files, restart container" + @echo " make sync - Sync local files to remote server" + @echo " make restart - Restart the Docker container" + @echo "" + @echo "Development:" + @echo " make logs - Tail container logs" + @echo " make test - Test TTS endpoint" + @echo " make voices - Download Piper voices properly" + @echo "" + @echo "Container:" + @echo " make start - Start Docker container" + @echo " make stop - Stop Docker container" + @echo " make clean - Stop and remove container" + +sync: + @echo "๐Ÿ“ฆ Syncing files to $(REMOTE_HOST)..." + rsync -avz --exclude '.git' --exclude '__pycache__' --exclude '*.pyc' \ + --exclude 'voices/*' --exclude 'config/voice_to_speaker.yaml' \ + ./ $(REMOTE_USER)@$(REMOTE_HOST):$(REMOTE_PATH)/ + +deploy: sync restart + @echo "โœ… Deployment complete!" + +restart: + @echo "๐Ÿ”„ Restarting container on $(REMOTE_HOST)..." + ssh $(REMOTE_USER)@$(REMOTE_HOST) "cd $(REMOTE_PATH) && docker compose restart" + +stop: + @echo "๐Ÿ›‘ Stopping container on $(REMOTE_HOST)..." + ssh $(REMOTE_USER)@$(REMOTE_HOST) "cd $(REMOTE_PATH) && docker compose down" + +start: + @echo "โ–ถ๏ธ Starting container on $(REMOTE_HOST)..." + ssh $(REMOTE_USER)@$(REMOTE_HOST) "cd $(REMOTE_PATH) && docker compose up -d" + +clean: stop + @echo "๐Ÿงน Removing container..." + ssh $(REMOTE_USER)@$(REMOTE_HOST) "cd $(REMOTE_PATH) && docker compose down -v" + +logs: + @echo "๐Ÿ“‹ Tailing logs from $(REMOTE_HOST)..." + ssh $(REMOTE_USER)@$(REMOTE_HOST) "docker logs -f $(CONTAINER_NAME)" + +test: + @echo "๐Ÿงช Testing TTS endpoint..." + curl -X POST http://$(REMOTE_HOST):8000/v1/audio/speech \ + -H "Content-Type: application/json" \ + -d '{"model":"tts-1","voice":"alloy","input":"Raccoon mission TTS test"}' \ + -o /tmp/raccoon_test.mp3 + @echo "โœ… Test complete! Playing audio..." + @firefox /tmp/raccoon_test.mp3 || mpv /tmp/raccoon_test.mp3 || echo "Install firefox or mpv to play audio" + +voices: + @echo "๐ŸŽค Downloading Piper voices with correct directory structure..." + ssh $(REMOTE_USER)@$(REMOTE_HOST) "docker exec $(CONTAINER_NAME) bash -c '\ + mkdir -p /app/voices/en/en_US/libritts_r/medium && \ + cd /app/voices/en/en_US/libritts_r/medium && \ + curl -L https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/libritts_r/medium/en_US-libritts_r-medium.onnx -o en_US-libritts_r-medium.onnx && \ + curl -L https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_US/libritts_r/medium/en_US-libritts_r-medium.onnx.json -o en_US-libritts_r-medium.onnx.json && \ + mkdir -p /app/voices/en/en_GB/northern_english_male/medium && \ + cd /app/voices/en/en_GB/northern_english_male/medium && \ + curl -L https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx -o en_GB-northern_english_male-medium.onnx && \ + curl -L https://huggingface.co/rhasspy/piper-voices/resolve/v1.0.0/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx.json -o en_GB-northern_english_male-medium.onnx.json'" + @echo "๐Ÿ“ Updating voice_to_speaker.yaml..." + ssh $(REMOTE_USER)@$(REMOTE_HOST) "docker exec $(CONTAINER_NAME) bash -c '\ + sed -i \"s|model: voices/en_US-libritts_r-medium.onnx|model: voices/en/en_US/libritts_r/medium/en_US-libritts_r-medium.onnx|g\" /app/config/voice_to_speaker.yaml && \ + sed -i \"s|model: voices/en_GB-northern_english_male-medium.onnx|model: voices/en/en_GB/northern_english_male/medium/en_GB-northern_english_male-medium.onnx|g\" /app/config/voice_to_speaker.yaml'" + @echo "โœ… Voices installed!" diff --git a/requirements.txt b/requirements.txt index b019783..80d52ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,9 @@ fastapi uvicorn loguru -piper-tts>=1.2.0 +# Use newer OHF-Voice fork instead of abandoned rhasspy version +# piper-tts>=1.2.0 +git+https://github.com/OHF-Voice/piper1-gpl.git@v1.3.0#subdirectory=src/python_run coqui-tts[languages] langdetect pyyaml