Skip to content

Commit eaa5055

Browse files
ms-jpqmeorphis
authored andcommitted
docs: use image edit example in readme (#722)
1 parent 7b34316 commit eaa5055

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,18 @@ file_object = openai.files.create(file: Pathname("input.jsonl"), purpose: "fine-
9696
# Alternatively, pass file contents or a `StringIO` directly:
9797
file_object = openai.files.create(file: File.read("input.jsonl"), purpose: "fine-tune")
9898

99+
puts(file_object.id)
100+
99101
# Or, to control the filename and/or content type:
100-
file = OpenAI::FilePart.new(File.read("input.jsonl"), filename: "input.jsonl", content_type: "")
101-
file_object = openai.files.create(file: file, purpose: "fine-tune")
102+
image = OpenAI::FilePart.new(Pathname('dog.jpg'), content_type: 'image/jpeg')
103+
edited = openai.images.edit(
104+
prompt: "make this image look like a painting",
105+
model: "gpt-image-1",
106+
size: '1024x1024',
107+
image: image
108+
)
102109

103-
puts(file_object.id)
110+
puts(edited.data.first)
104111
```
105112

106113
Note that you can also pass a raw `IO` descriptor, but this disables retries, as the library can't be sure if the descriptor is a file or pipe (which cannot be rewound).

0 commit comments

Comments
 (0)