Skip to content

Commit b84c0f9

Browse files
committed
update code samples
1 parent 12f61ed commit b84c0f9

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ List<String> images = imageModel.generateImages(imageInput);
7171
```
7272
Output:<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

7585
For full example check the code inside sample_code project.
7686

sample_code/src/com/intelliJava/test/GoogleApp.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)