llamagen-python 0.1.12__tar.gz → 0.1.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/PKG-INFO +8 -3
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/README.md +7 -2
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/examples/Untitled.ipynb +36 -19
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/examples/quickstart.py +7 -2
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/pyproject.toml +1 -1
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/src/llamagen/__init__.py +1 -1
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/src/llamagen/_http.py +1 -1
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/tests/test_client.py +1 -1
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/.gitignore +0 -0
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/LICENSE +0 -0
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/docs/RELEASE.md +0 -0
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/src/llamagen/_client.py +0 -0
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/src/llamagen/_errors.py +0 -0
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/src/llamagen/_types.py +0 -0
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/src/llamagen/py.typed +0 -0
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/src/llamagen/resources/__init__.py +0 -0
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/src/llamagen/resources/animations.py +0 -0
- {llamagen_python-0.1.12 → llamagen_python-0.1.13}/src/llamagen/resources/comics.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: llamagen-python
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.13
|
|
4
4
|
Summary: Official Python SDK for LlamaGen Comic API and Animation API
|
|
5
5
|
Project-URL: Homepage, https://llamagen.ai/comic-api
|
|
6
6
|
Project-URL: Documentation, https://llamagen.ai/comic-api/docs
|
|
@@ -125,11 +125,16 @@ generation = client.comic.create({
|
|
|
125
125
|
"comicRoles": [
|
|
126
126
|
{
|
|
127
127
|
"name": "The Little Prince",
|
|
128
|
-
"image": "https://
|
|
128
|
+
"image": "https://s.llamagen.ai/public/61965b97-23fe-4405-853d-efe17b5d6f08-prince.webp",
|
|
129
129
|
"dress": "green coat and yellow scarf",
|
|
130
130
|
}
|
|
131
131
|
],
|
|
132
|
-
"attachments": [
|
|
132
|
+
"attachments": [
|
|
133
|
+
{
|
|
134
|
+
"type": "image",
|
|
135
|
+
"url": "https://s.llamagen.ai/public/7eeaad2c-fd6b-4679-90ce-884503f011b7-reference.webp",
|
|
136
|
+
}
|
|
137
|
+
],
|
|
133
138
|
"language": "en",
|
|
134
139
|
"upscale": "2K",
|
|
135
140
|
})
|
|
@@ -100,11 +100,16 @@ generation = client.comic.create({
|
|
|
100
100
|
"comicRoles": [
|
|
101
101
|
{
|
|
102
102
|
"name": "The Little Prince",
|
|
103
|
-
"image": "https://
|
|
103
|
+
"image": "https://s.llamagen.ai/public/61965b97-23fe-4405-853d-efe17b5d6f08-prince.webp",
|
|
104
104
|
"dress": "green coat and yellow scarf",
|
|
105
105
|
}
|
|
106
106
|
],
|
|
107
|
-
"attachments": [
|
|
107
|
+
"attachments": [
|
|
108
|
+
{
|
|
109
|
+
"type": "image",
|
|
110
|
+
"url": "https://s.llamagen.ai/public/7eeaad2c-fd6b-4679-90ce-884503f011b7-reference.webp",
|
|
111
|
+
}
|
|
112
|
+
],
|
|
108
113
|
"language": "en",
|
|
109
114
|
"upscale": "2K",
|
|
110
115
|
})
|
|
@@ -42,34 +42,51 @@
|
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
"cell_type": "code",
|
|
45
|
-
"execution_count":
|
|
45
|
+
"execution_count": 2,
|
|
46
46
|
"id": "f0c6df20-22f8-410e-9920-691f2d9b6557",
|
|
47
47
|
"metadata": {},
|
|
48
|
-
"outputs": [
|
|
48
|
+
"outputs": [
|
|
49
|
+
{
|
|
50
|
+
"name": "stdout",
|
|
51
|
+
"output_type": "stream",
|
|
52
|
+
"text": [
|
|
53
|
+
"comic.create: cmrfstpbx0003l604n4njl7e3 LOADING\n",
|
|
54
|
+
"comic.wait_for_completion: cmrfstpbx0003l604n4njl7e3 PROCESSED [{'page': 0, 'prompt': 'A 4-panel comic about Leo finding a glowing key in a quiet library.', 'beginPageIndex': 0, 'totalPages': 1, 'panelsPerPage': 4, 'layout': 'Layout0', 'panels': [{'assetUrl': 'https://s.llamagen.ai/clr907a8t0000jp08cgdqv78h/bfa3c3a1-9ab7-491a-9937-c1682332cea4.png', 'panel': 0, 'caption': \"It's so peaceful here... So many books I've never read.\", 'image': []}, {'assetUrl': 'https://s.llamagen.ai/clr907a8t0000jp08cgdqv78h/9074f3ac-b3b4-4dd5-b908-5a203065e5b4.png', 'panel': 1, 'caption': 'What is that light...?', 'image': []}, {'assetUrl': 'https://s.llamagen.ai/clr907a8t0000jp08cgdqv78h/a5b6902d-bb04-4519-9f95-f99926bcb260.png', 'panel': 2, 'caption': \"Is this someone's lost key? It's so bright...\", 'image': []}, {'assetUrl': 'https://s.llamagen.ai/clr907a8t0000jp08cgdqv78h/30c758d6-209f-46f4-8f0d-84ca156151c3.png', 'panel': 3, 'caption': 'What secrets do you hold?', 'image': []}], 'update': 1783740192609, 'firstUpdate': 1783740192609}]\n"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
],
|
|
49
58
|
"source": [
|
|
50
59
|
"import os\n",
|
|
51
60
|
"\n",
|
|
52
61
|
"from llamagen import LlamaGenClient\n",
|
|
53
62
|
"\n",
|
|
54
|
-
"
|
|
63
|
+
"WAIT_TIMEOUT_MS = 30 * 60 * 1000\n",
|
|
64
|
+
"\n",
|
|
65
|
+
"client = LlamaGenClient(\n",
|
|
66
|
+
" api_key=\"sk-5d609cd64379d048edcb04dcc109a6cfaf7c066f12138c13c8c404766ab9629d\",\n",
|
|
67
|
+
" timeout_ms=30000,\n",
|
|
68
|
+
" max_retries=5,\n",
|
|
69
|
+
" retry_delay_ms=500,\n",
|
|
70
|
+
")\n",
|
|
71
|
+
"\n",
|
|
72
|
+
"created = client.comic.create({\n",
|
|
73
|
+
" \"prompt\": \"A 4-panel comic about Leo finding a glowing key in a quiet library.\",\n",
|
|
74
|
+
" \"preset\": \"japanese_manga\",\n",
|
|
75
|
+
" \"fixPanelNum\": 4,\n",
|
|
76
|
+
"})\n",
|
|
77
|
+
"print(\"comic.create:\", created[\"id\"], created.get(\"status\"))\n",
|
|
55
78
|
"\n",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
" \"style\": \"storybook manga\",\n",
|
|
59
|
-
" \"size\": \"1024x1024\",\n",
|
|
60
|
-
" \"pagination\": {\"totalPages\": 2, \"panelsPerPage\": 4},\n",
|
|
61
|
-
" \"comicRoles\": [\n",
|
|
62
|
-
" {\n",
|
|
63
|
-
" \"name\": \"The Little Prince\",\n",
|
|
64
|
-
" \"image\": \"https://example.com/prince.png\",\n",
|
|
65
|
-
" \"clothing\": \"green coat and yellow scarf\",\n",
|
|
66
|
-
" }\n",
|
|
67
|
-
" ],\n",
|
|
68
|
-
" \"attachments\": [{\"type\": \"image\", \"url\": \"https://example.com/reference.png\"}],\n",
|
|
69
|
-
" \"language\": \"en\",\n",
|
|
70
|
-
" \"upscale\": \"2K\",\n",
|
|
71
|
-
"})"
|
|
79
|
+
"done = client.comic.wait_for_completion(created[\"id\"], timeout_ms=WAIT_TIMEOUT_MS)\n",
|
|
80
|
+
"print(\"comic.wait_for_completion:\", done[\"id\"], done.get(\"status\"), done.get(\"comics\"))"
|
|
72
81
|
]
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"cell_type": "code",
|
|
85
|
+
"execution_count": null,
|
|
86
|
+
"id": "77cc80bf-967e-4da5-bf9e-d8858914f2a4",
|
|
87
|
+
"metadata": {},
|
|
88
|
+
"outputs": [],
|
|
89
|
+
"source": []
|
|
73
90
|
}
|
|
74
91
|
],
|
|
75
92
|
"metadata": {
|
|
@@ -71,11 +71,16 @@ def create_comic_with_advanced_options(client: LlamaGenClient) -> None:
|
|
|
71
71
|
"comicRoles": [
|
|
72
72
|
{
|
|
73
73
|
"name": "The Little Prince",
|
|
74
|
-
"image": "https://
|
|
74
|
+
"image": "https://s.llamagen.ai/public/61965b97-23fe-4405-853d-efe17b5d6f08-prince.webp",
|
|
75
75
|
"dress": "green coat and yellow scarf",
|
|
76
76
|
}
|
|
77
77
|
],
|
|
78
|
-
"attachments": [
|
|
78
|
+
"attachments": [
|
|
79
|
+
{
|
|
80
|
+
"type": "image",
|
|
81
|
+
"url": "https://s.llamagen.ai/public/7eeaad2c-fd6b-4679-90ce-884503f011b7-reference.webp",
|
|
82
|
+
}
|
|
83
|
+
],
|
|
79
84
|
"language": "en",
|
|
80
85
|
"upscale": "2K",
|
|
81
86
|
}
|
|
@@ -10,7 +10,7 @@ from typing import Any, Dict, Mapping, Optional, Protocol, Tuple
|
|
|
10
10
|
|
|
11
11
|
from ._errors import LlamaGenAPIError, LlamaGenConnectionError, LlamaGenTimeoutError
|
|
12
12
|
|
|
13
|
-
DEFAULT_USER_AGENT = "llamagen-python/0.1.
|
|
13
|
+
DEFAULT_USER_AGENT = "llamagen-python/0.1.13"
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
class Transport(Protocol):
|
|
@@ -80,7 +80,7 @@ class ClientTests(unittest.TestCase):
|
|
|
80
80
|
self.assertEqual(call["url"], "https://api.llamagen.ai/v1/comics/generations")
|
|
81
81
|
self.assertEqual(call["headers"]["Authorization"], "Bearer test-key")
|
|
82
82
|
self.assertEqual(call["headers"]["Accept"], "application/json")
|
|
83
|
-
self.assertEqual(call["headers"]["User-Agent"], "llamagen-python/0.1.
|
|
83
|
+
self.assertEqual(call["headers"]["User-Agent"], "llamagen-python/0.1.13")
|
|
84
84
|
body = json.loads(call["body"].decode("utf-8"))
|
|
85
85
|
self.assertEqual(body["preset"], "neutral")
|
|
86
86
|
self.assertEqual(body["size"], "1024x1024")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|