Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alltalk TTS #1096

Merged
merged 6 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions agixt/extensions/alltalk_tts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import requests
import base64
import uuid
from Extensions import Extensions


class alltalk_tts(Extensions):
def __init__(
self,
voice: str = "default",
**kwargs,
):
self.voice = voice
self.commands = {
"Speak with TTS with Alltalk Text to Speech": self.speak_with_alltalk_tts
}

async def speak_with_alltalk_tts(
self,
text: str,
):
data = {
"text": text,
"voice": self.voice,
"language": "en",
"temperature": 0.7,
"repetition_penalty": 10.0,
"output_file": f"{uuid.uuid4()}.wav",
"streaming": False,
}
response = requests.post(
"http://alltalk-tts:7851/api/generate",
json=data,
)
return f"{text}\n#GENERATED_AUDIO:{base64.b64encode(response.content).decode('utf-8')}"
25 changes: 25 additions & 0 deletions alltalk.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"activate": true,
"autoplay": true,
"branding": "AllTalk ",
"narrator_enabled": false,
"deepspeed_activate": true,
"delete_output_wavs": "Disabled",
"ip_address": "127.0.0.1",
"language": "English",
"low_vram": false,
"local_temperature": "0.7",
"local_repetition_penalty": "10.0",
"tts_model_loaded": true,
"tts_model_name": "tts_models/multilingual/multi-dataset/xtts_v2",
"narrator_voice": "female_01.wav",
"output_folder_wav": "extensions/alltalk_tts/outputs/",
"output_folder_wav_standalone": "outputs/",
"port_number": "7851",
"remove_trailing_dots": false,
"show_text": true,
"tts_method_api_local": false,
"tts_method_api_tts": false,
"tts_method_xtts_local": true,
"voice": "female_01.wav"
}
27 changes: 26 additions & 1 deletion docker-compose-dev-cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,29 @@ services:
ports:
- "8091:8091"
volumes:
- ./models:/app/models
- ./models:/app/models
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [ gpu ]
alltalk-tts:
image: joshxt/alltalk_tts:cuda
restart: unless-stopped
ports:
- "7851:7851"
volumes:
- ./WORKSPACE/outputs:/app/outputs/
- ./models:/app/models/
- ./voices:/app/voices/
- ./finetune/put-voice-samples-in-here:/app/finetune/put-voice-samples-in-here
- ./alltalk.json:/app/confignew.json
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [ gpu ]
13 changes: 12 additions & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,15 @@ services:
ports:
- "8091:8091"
volumes:
- ./models:/app/models
- ./models:/app/models
alltalk-tts:
image: joshxt/alltalk_tts:cpu
restart: unless-stopped
ports:
- "7851:7851"
volumes:
- ./WORKSPACE/outputs:/app/outputs/
- ./WORKSPACE/audio-samples:/app/finetune/put-voice-samples-in-here/
- ./models:/app/models/
- ./voices:/app/voices/
- ./alltalk.json:/app/confignew.json
Binary file added voices/default.wav
Binary file not shown.
Loading