Skip to content

Commit 8733504

Browse files
author
yiguang
committed
fix(arkruntime): add image size for seedream api
1 parent 8e0f736 commit 8733504

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

volcenginesdkarkruntime/resources/images/images.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def generate(
125125
sequential_image_generation: str | None = None,
126126
sequential_image_generation_options: SequentialImageGenerationOptions | None = None,
127127
stream: Optional[Literal[False]] | Literal[True] | NotGiven = NOT_GIVEN,
128-
) -> ImagesResponse:
128+
) -> ImagesResponse | Stream[ImageGenStreamEvent]:
129129
resp = self._post(
130130
"/images/generations",
131131
body={

volcenginesdkarkruntime/types/images/images.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class Image(BaseModel):
3333
b64_json: str
3434
"""The Base 64 encoded string of the generated image, if any."""
3535

36+
size: str
37+
"""The size of the generated image, if any."""
38+
3639

3740
class Error(BaseModel):
3841
message: str

volcenginesdkexamples/volcenginesdkarkruntime/image_generations.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
print("----- [Seededit] generate images -----")
2525

2626
result = client.images.generate(
27-
model="${YOUR_SEEDEDIT_ENDPOINT_ID}",
27+
model="${YOUR_SEEDREAM_ENDPOINT_ID}",
2828
prompt="龙与地下城女骑士背景是起伏的平原,目光从镜头转向平原",
29-
image="${YOUR_IMAGE_URL}",
29+
# image="${YOUR_IMAGE_URL}",
3030
seed=1234567890,
3131
watermark=True,
32-
size="adaptive",
32+
size="1024x1024",
3333
)
3434

3535
print(result)
@@ -40,7 +40,7 @@
4040
model="${YOUR_SEEDREAM_ENDPOINT_ID}",
4141
prompt="星球大战, 需要三幅图片描绘不同的战斗场景",
4242
response_format="url",
43-
image=["YOUR_IMAGE_URL_HERE", "YOUR_IMAGE_URL_HERE"],
43+
# image=["YOUR_IMAGE_URL_HERE", "YOUR_IMAGE_URL_HERE"],
4444
seed=1234567890,
4545
watermark=True,
4646
size="1024x1024",
@@ -66,6 +66,3 @@
6666
if event.error is None:
6767
print("Final completed event:")
6868
print("recv.Usage:", event.usage)
69-
70-
elif event.type == "image_generation.partial_image":
71-
print(f"Partial image index={event.partial_image_index}, size={len(event.b64_json)}")

0 commit comments

Comments
 (0)