This repository has been archived by the owner on Oct 30, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
cookbook for aws-polly #6
Open
chinazor-allen
wants to merge
1
commit into
Syncano:master
Choose a base branch
from
chinazor-allen:aws-polly
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# AWS Polly | ||
|
||
* Preparation: **2 minutes** | ||
* Requirements: | ||
* Initiated Syncano project | ||
* AWS ACCESS_KEY_ID | ||
* AWS SECRET_ACCESS_KEY | ||
* Region | ||
|
||
### Problem to solve | ||
|
||
You want to integrate a service that converts text to speech into application: | ||
|
||
### Solution | ||
|
||
Our solution is established using [aws-polly](https://syncano.io/#/sockets/aws-polly) Text-to-Speech (TTS) cloud service that converts text into lifelike speech. | ||
|
||
### Installing dependencies | ||
|
||
#### Server-side | ||
|
||
To install aws-polly, type: | ||
|
||
```sh | ||
$ syncano-cli add aws-polly | ||
``` | ||
|
||
Provide `AWS ACCESS_KEY_ID`, `AWS SECRET_ACCESS_KEY` and `Region` | ||
|
||
* N/B: To find `AWS ACCESS_KEY_ID` and `AWS SECRET_ACCESS_KEY`, log into your AWS account to get it. | ||
Also to get `Region`, search for Polly on your AWS Console to check supported regions and select one (e.g, us-east-1 ) | ||
|
||
Deploy aws-polly to update socket | ||
|
||
```sh | ||
$ syncano-cli deploy aws-polly | ||
``` | ||
|
||
#### Client-side | ||
|
||
Install syncano-client to interact with Syncano aws-polly socket: | ||
N/B: There are two way's of achieving installation. | ||
|
||
1. When using webpack and es6 the way to handle the client lib is: | ||
Shell: | ||
|
||
```sh | ||
$ npm i -S @syncano/client | ||
``` | ||
|
||
Create a connection by initializing Syncano object with instance name: | ||
|
||
```javascript | ||
import SyncanoClient from "@syncano/client" | ||
|
||
const s = new SyncanoClient("MY_INSTANCE_NAME"); | ||
``` | ||
|
||
2. And the vanilla js way: | ||
```HTML | ||
<script src="https://unpkg.com/@syncano/client"></script> | ||
<script> | ||
const s = new SyncanoClient("MY_INSTANCE_NAME"); | ||
</script> | ||
``` | ||
|
||
Implement text-to-speech process using aws-polly synthesizeSpeech endpoint: | ||
|
||
```javascript | ||
|
||
const polly = synthesizeSpeechParams => { | ||
try { | ||
const synthesizeSpeech = s.post("aws-polly/synthesizeSpeech", synthesizeSpeechParams); | ||
(response) => { | ||
return { data: response.data} | ||
} | ||
} catch (error) { | ||
return error.message; | ||
} | ||
}; | ||
``` | ||
|
||
### Testing functionality | ||
|
||
Now you can create a text-box collecting text from user and pass on to script file for conversion to speech. On you application, You could decide for your users to download file or listen to speech. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and pass it on to the |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/into application:/into your application.