Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 32b4c98

Browse filesBrowse files
author
Firahs
authored
Added Image generation example (TheoKanning#87)
1 parent 1a463b6 commit 32b4c98
Copy full SHA for 32b4c98

File tree

Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-0
lines changed

‎example/src/main/java/example/OpenAiApiExample.java

Copy file name to clipboardExpand all lines: example/src/main/java/example/OpenAiApiExample.java
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.theokanning.openai.OpenAiService;
44
import com.theokanning.openai.completion.CompletionRequest;
5+
import com.theokanning.openai.image.CreateImageRequest;
56

67
class OpenAiApiExample {
78
public static void main(String... args) {
@@ -16,5 +17,13 @@ public static void main(String... args) {
1617
.user("testing")
1718
.build();
1819
service.createCompletion(completionRequest).getChoices().forEach(System.out::println);
20+
21+
System.out.println("\nCreating Image...");
22+
CreateImageRequest request = CreateImageRequest.builder()
23+
.prompt("A cow breakdancing with a turtle")
24+
.build();
25+
26+
System.out.println("\nImage is located at:");
27+
System.out.println(service.createImage(request).getData().get(0).getUrl());
1928
}
2029
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.