Skip to content

Commit

Permalink
added 11 labs
Browse files Browse the repository at this point in the history
  • Loading branch information
DrJJ committed Jun 18, 2024
1 parent 47b9a46 commit 3e33c87
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ examples/grammars/Recordings/**/User6/*
examples/grammars/Recordings/**/User7/*
examples/grammars/Recordings/**/User8/*
examples/grammars/Recordings/**/User9/*

TTS/11labs/*.wav
25 changes: 25 additions & 0 deletions TTS/11labs/synthesize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import requests

CHUNK_SIZE = 1024
url = "https://api.elevenlabs.io/v1/text-to-speech/7p1Ofvcwsv7UBPoFNcpI?output_format=pcm_16000"

headers = {
"Accept": "audio/wav",
"Content-Type": "application/json",
"xi-api-key": "<key>"
}

data = {
"text": "<prosody rate=\"medium\">To verify your account, I will need 3 things:<break time=\"0.5s\"/> your full name,<break time=\"0.3s\"/> your date of birth,<break time=\"0.3s\"/> and your address. Can you provide me those 3 things please?</prosody>",
"model_id": "eleven_monolingual_v1",
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.5
}
}

response = requests.post(url, json=data, headers=headers)
with open('11-labs-output-e1.wav', 'wb') as f:
for chunk in response.iter_content(chunk_size=CHUNK_SIZE):
if chunk:
f.write(chunk)
107 changes: 107 additions & 0 deletions declarative-ivr/select-and-transfer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"DEFAULTS": {
"repromtOnDisconfirm": "Sorry, I did not hear it.",
"prefixes": {
"noInput": [
"Sorry, I did not hear it.",
"Sorry, I still did not hear it."
],
"noMatch": [
"Sorry, I did not get it.",
"Sorry, I still did not get it."
]
}
},
"GRAMMARS": {
"NameCheck": {
"type": "JJSGF",
"parameters": {
"tag-format": "semantics/1.0-literals"
},
"grammar": "namecheck",
"public": {
"root": "<Bob> {Bob} | <Frank> {Frank} "
},
"rules": {
"Bob": "(Bob)",
"Frank": "(Frank)"
}
}
},
"ENTRY": {
"type": "VOID",
"voice": "catherine",
"next": "Welcome"
},
"ERROR": {
"type": "DISCONNECT",
"prompt": "Sorry, there was an error. Please call back later",
"reason": "ERROR"
},
"Welcome": {
"type": "OUTPUT",
"voice": "catherine",
"prompt": "Welcome to Transfer Genie",
"next": "HandleUserSelection"
},
"HandleUserSelection": {
"type": "INPUT",
"name": "userSelect",
"voice": "catherine",
"prompt": "Please say the name of the person you want to talk to",
"bargeIn": true,
"grammar": [
"NameCheck"
],
"noInputMax": 2,
"noMatchMax": 2,
"confirmation": {
"threshold": 0.5,
"prompt": "You selected ${userSelect}. Is that correct?"
},
"fail": "CallHealth",
"next": "ProcessUserSelection"
},
"ProcessUserSelection": {
"type": "EVAL",
"eval": "'${userSelect}'",
"case": [
{
"expr": "'${1}'=='Bob'",
"next": "TransferforBob"
},
{
"expr": "'${1}'=='Frank'",
"next": "TransferforFrank"
}
]
},
"TransferforBob": {
"type": "TRANSFER",
"voice": "catherine",
"prompt": "Dialing Bob's extension 20955088",
"phone": {
"phoneNumber": "+13212918281,www20955088"
},
"fail": "TransferFailed"
},
"TransferforFrank": {
"type": "TRANSFER",
"voice": "catherine",
"prompt": "Dialing Frank's extension 703",
"phone": {
"phoneNumber": "+19725180863,www7w0w3"
},
"fail": "TransferFailed"
},
"TransferFailed": {
"type": "DISCONNECT",
"prompt": "Sorry, the transfer failed. Good bye.",
"reason": "Transfer Failed"
},
"CallHealth": {
"type": "DISCONNECT",
"prompt": "I have trouble understanding you. Please call back later",
"reason": "CALL-HEALTH"
}
}
82 changes: 82 additions & 0 deletions declarative-ivr/select-and-transfer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
---
DEFAULTS:
repromtOnDisconfirm: Sorry, I did not hear it.
prefixes:
noInput:
- Sorry, I did not hear it.
- Sorry, I still did not hear it.
noMatch:
- Sorry, I did not get it.
- Sorry, I still did not get it.
GRAMMARS:
NameCheck:
type: JJSGF
parameters:
tag-format: semantics/1.0-literals
grammar: namecheck
public:
root: "<Bob> {Bob} | <Frank> {Frank} "
rules:
Bob: "(Bob)"
Frank: "(Frank)"

ENTRY:
type: VOID
voice: catherine
next: Welcome
ERROR:
type: DISCONNECT
prompt: Sorry, there was an error. Please call back later
reason: ERROR
Welcome:
type: OUTPUT
voice: catherine
prompt: Welcome to Transfer Genie
next: HandleUserSelection
HandleUserSelection:
type: INPUT
name: userSelect
voice: catherine
prompt: Please say the name of the person you want to talk to
bargeIn: true
grammar:
- NameCheck
noInputMax: 2
noMatchMax: 2
confirmation:
threshold: 0.5
prompt: 'You selected ${userSelect}. Is that correct?'
fail: CallHealth
next: ProcessUserSelection
ProcessUserSelection:
type: EVAL
eval: "'${userSelect}'"
case:
- expr: "'${1}'=='Bob'"
next: TransferforBob
- expr: "'${1}'=='Frank'"
next: TransferforFrank
TransferforBob:
type: TRANSFER
voice: catherine
prompt: Dialing Bob's extension
phone:
phoneNumber: "+19725180863,wwww700"
fail: TransferFailed
TransferforFrank:
type: TRANSFER
voice: catherine
prompt: Dialing Frank's extension
phone:
phoneNumber: "+19725180863,wwww701"
fail: TransferFailed
TransferFailed:
type: DISCONNECT
prompt: Sorry, the transfer failed. Good bye.
reason: Transfer Failed
CallHealth:
type: DISCONNECT
prompt: I have trouble understanding you. Please call back later
reason: CALL-HEALTH


11 changes: 7 additions & 4 deletions new-examples/off-line/ol-upload-bulk.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
inputFolder = cfg.get("DEFAULT", "INPUTFOLDER")
outputFolder = cfg.get("DEFAULT", "OUTPUTFOLDER")

#model = "VoiceGain-omega"
model = "VoiceGain-omega"
#model = None
model = "whisper:medium"
#model = "whisper:medium"

print("model: {}".format(model))

Expand Down Expand Up @@ -52,8 +52,11 @@
},
"settings": {
"asr": {
#"languages" : ["es", "en"],
"languages" : ["en"],
"languages" : ["es", "en"],
#"languages" : ["en"],
"languageDetection" : {
"aggregation" : "start_weighted",
},
"acousticModelNonRealTime" : model,
"noInputTimeout": -1,
"completeTimeout": -1,
Expand Down
8 changes: 4 additions & 4 deletions new-examples/off-line/ol-upload-single.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
inputFname = cfg.get("DEFAULT", "INPUTFILE")
outputFolder = cfg.get("DEFAULT", "OUTPUTFOLDER")

#model = "VoiceGain-omega"
model = "VoiceGain-omega"
#model = None
model = "whisper:medium"
#model = "whisper:medium"

print("model: {}".format(model))

Expand Down Expand Up @@ -55,8 +55,8 @@
},
"settings": {
"asr": {
#"languages" : ["es", "en"],
"languages" : ["de"],
"languages" : ["es", "en"],
#"languages" : ["de"],
"acousticModelNonRealTime" : model,
"noInputTimeout": -1,
"completeTimeout": -1,
Expand Down

0 comments on commit 3e33c87

Please sign in to comment.