File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
sample_code/src/com/intelliJava/test Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,16 @@ List<String> images = imageModel.generateImages(imageInput);
7171```
7272Output:<br >
7373<img src =" images/response_image.png " height =" 220px " >
74+ <br ><br >
75+ ** Text to speech code** (2 steps):
76+ ``` java
77+ // 1- initiate the remote speech model
78+ RemoteSpeechModel model = new RemoteSpeechModel (apiKey, SpeechModels . google);
79+
80+ // 2- call generateImages with any command !
81+ SpeechInput input = new SpeechInput .Builder (" Hi, I am Intelligent Java." ). build();
82+ List<String > images = imageModel. generateImages(imageInput);
83+ ```
7484
7585For full example check the code inside sample_code project.
7686
Original file line number Diff line number Diff line change @@ -43,10 +43,11 @@ public static void main(String[] args) {
4343 */
4444 private static void tryGoogleSpeechModel (String apiKey ) throws IOException {
4545
46- SpeechInput input = new SpeechInput ("Hi, I am Intelligent Java." , Gender .FEMALE );
4746
4847 RemoteSpeechModel model = new RemoteSpeechModel (apiKey , SpeechModels .google );
4948
49+ SpeechInput input = new SpeechInput .Builder ("Hi, I am Intelligent Java." ).build ();
50+
5051 // get the audio bytes
5152 // you can play it using libraries like javafx
5253 byte [] decodedAudio = model .generateEnglishText (input );
You can’t perform that action at this time.
0 commit comments