Skip to content

Commit 029c34f

Browse files
authored
Add batch size in the Constructor.
Using 10 as batch size was throwing an issue : "error": { "message": "{'task\_type': 'text2im', 'prompt': {'caption': 'portal to another dimension, digital art', 'batch\_size': 10}} is not valid under any of the given schemas", "type": "invalid\_request\_error", "param": null, "code": null } }
1 parent 7b6edaf commit 029c34f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/dalle2/dalle2.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
import os
77

88
class Dalle2():
9-
def __init__(self, bearer):
9+
def __init__(self, bearer, batch_size):
1010
self.bearer = bearer
11+
self.batch_size = batch_size
1112

1213
def generate(self, promt):
1314
url = "https://labs.openai.com/api/labs/tasks"
@@ -19,7 +20,7 @@ def generate(self, promt):
1920
"task_type": "text2im",
2021
"prompt": {
2122
"caption": promt,
22-
"batch_size": 6,
23+
"batch_size": self.batch_size,
2324
}
2425
}
2526

0 commit comments

Comments
 (0)