webscout 7.7__py3-none-any.whl → 7.8__py3-none-any.whl

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.

Potentially problematic release.


This version of webscout might be problematic. Click here for more details.

Files changed (121) hide show
  1. webscout/AIutel.py +2 -1
  2. webscout/Bard.py +14 -11
  3. webscout/DWEBS.py +431 -415
  4. webscout/Extra/autocoder/__init__.py +9 -9
  5. webscout/Extra/autocoder/autocoder_utiles.py +332 -194
  6. webscout/Extra/autocoder/rawdog.py +68 -9
  7. webscout/Extra/gguf.py +682 -682
  8. webscout/Provider/AI21.py +1 -1
  9. webscout/Provider/AISEARCH/DeepFind.py +2 -2
  10. webscout/Provider/AISEARCH/ISou.py +2 -2
  11. webscout/Provider/AISEARCH/felo_search.py +6 -6
  12. webscout/Provider/AISEARCH/genspark_search.py +1 -1
  13. webscout/Provider/Aitopia.py +292 -0
  14. webscout/Provider/AllenAI.py +1 -1
  15. webscout/Provider/Andi.py +3 -3
  16. webscout/Provider/C4ai.py +1 -1
  17. webscout/Provider/ChatGPTES.py +3 -5
  18. webscout/Provider/ChatGPTGratis.py +4 -4
  19. webscout/Provider/Chatify.py +2 -2
  20. webscout/Provider/Cloudflare.py +3 -2
  21. webscout/Provider/DARKAI.py +3 -2
  22. webscout/Provider/DeepSeek.py +2 -2
  23. webscout/Provider/Deepinfra.py +1 -1
  24. webscout/Provider/EDITEE.py +1 -1
  25. webscout/Provider/ElectronHub.py +178 -96
  26. webscout/Provider/ExaChat.py +310 -0
  27. webscout/Provider/Free2GPT.py +2 -2
  28. webscout/Provider/Gemini.py +5 -19
  29. webscout/Provider/GithubChat.py +1 -1
  30. webscout/Provider/Glider.py +4 -4
  31. webscout/Provider/Groq.py +3 -3
  32. webscout/Provider/HF_space/qwen_qwen2.py +1 -1
  33. webscout/Provider/HeckAI.py +1 -1
  34. webscout/Provider/HuggingFaceChat.py +1 -1
  35. webscout/Provider/Hunyuan.py +1 -1
  36. webscout/Provider/Jadve.py +3 -3
  37. webscout/Provider/Koboldai.py +3 -3
  38. webscout/Provider/LambdaChat.py +1 -1
  39. webscout/Provider/Llama.py +3 -5
  40. webscout/Provider/Llama3.py +4 -12
  41. webscout/Provider/Marcus.py +3 -3
  42. webscout/Provider/OLLAMA.py +8 -8
  43. webscout/Provider/Openai.py +7 -3
  44. webscout/Provider/PI.py +1 -1
  45. webscout/Provider/Perplexitylabs.py +1 -1
  46. webscout/Provider/Phind.py +1 -1
  47. webscout/Provider/PizzaGPT.py +1 -1
  48. webscout/Provider/QwenLM.py +4 -7
  49. webscout/Provider/TTI/FreeAIPlayground/async_freeaiplayground.py +3 -1
  50. webscout/Provider/TTI/FreeAIPlayground/sync_freeaiplayground.py +3 -3
  51. webscout/Provider/TTI/ImgSys/__init__.py +23 -0
  52. webscout/Provider/TTI/ImgSys/async_imgsys.py +202 -0
  53. webscout/Provider/TTI/ImgSys/sync_imgsys.py +195 -0
  54. webscout/Provider/TTI/__init__.py +3 -1
  55. webscout/Provider/TTI/artbit/async_artbit.py +1 -1
  56. webscout/Provider/TTI/artbit/sync_artbit.py +1 -1
  57. webscout/Provider/TTI/huggingface/async_huggingface.py +1 -1
  58. webscout/Provider/TTI/huggingface/sync_huggingface.py +1 -1
  59. webscout/Provider/TTI/piclumen/__init__.py +22 -22
  60. webscout/Provider/TTI/piclumen/sync_piclumen.py +232 -232
  61. webscout/Provider/TTI/pixelmuse/__init__.py +4 -0
  62. webscout/Provider/TTI/pixelmuse/async_pixelmuse.py +249 -0
  63. webscout/Provider/TTI/pixelmuse/sync_pixelmuse.py +182 -0
  64. webscout/Provider/TTI/talkai/sync_talkai.py +1 -1
  65. webscout/Provider/TTS/utils.py +1 -1
  66. webscout/Provider/TeachAnything.py +1 -1
  67. webscout/Provider/TextPollinationsAI.py +4 -4
  68. webscout/Provider/TwoAI.py +1 -2
  69. webscout/Provider/Venice.py +4 -2
  70. webscout/Provider/VercelAI.py +234 -0
  71. webscout/Provider/WebSim.py +3 -2
  72. webscout/Provider/WiseCat.py +10 -12
  73. webscout/Provider/Youchat.py +1 -1
  74. webscout/Provider/__init__.py +10 -0
  75. webscout/Provider/ai4chat.py +1 -1
  76. webscout/Provider/aimathgpt.py +2 -6
  77. webscout/Provider/akashgpt.py +1 -1
  78. webscout/Provider/askmyai.py +4 -4
  79. webscout/Provider/asksteve.py +203 -0
  80. webscout/Provider/bagoodex.py +2 -2
  81. webscout/Provider/cerebras.py +1 -1
  82. webscout/Provider/chatglm.py +4 -4
  83. webscout/Provider/cleeai.py +1 -0
  84. webscout/Provider/copilot.py +427 -415
  85. webscout/Provider/elmo.py +1 -1
  86. webscout/Provider/flowith.py +1 -1
  87. webscout/Provider/freeaichat.py +57 -31
  88. webscout/Provider/gaurish.py +3 -5
  89. webscout/Provider/geminiprorealtime.py +1 -1
  90. webscout/Provider/granite.py +4 -4
  91. webscout/Provider/hermes.py +5 -5
  92. webscout/Provider/julius.py +1 -1
  93. webscout/Provider/koala.py +1 -1
  94. webscout/Provider/lepton.py +1 -1
  95. webscout/Provider/llama3mitril.py +4 -4
  96. webscout/Provider/llamatutor.py +1 -1
  97. webscout/Provider/llmchat.py +3 -3
  98. webscout/Provider/meta.py +1 -1
  99. webscout/Provider/multichat.py +10 -10
  100. webscout/Provider/promptrefine.py +1 -1
  101. webscout/Provider/searchchat.py +293 -0
  102. webscout/Provider/sonus.py +2 -2
  103. webscout/Provider/talkai.py +2 -2
  104. webscout/Provider/turboseek.py +1 -1
  105. webscout/Provider/tutorai.py +1 -1
  106. webscout/Provider/typegpt.py +5 -42
  107. webscout/Provider/uncovr.py +4 -2
  108. webscout/Provider/x0gpt.py +1 -1
  109. webscout/__init__.py +36 -36
  110. webscout/cli.py +293 -332
  111. webscout/tempid.py +11 -11
  112. webscout/utils.py +2 -2
  113. webscout/version.py +1 -1
  114. webscout/webscout_search.py +1282 -1223
  115. webscout/webscout_search_async.py +813 -692
  116. {webscout-7.7.dist-info → webscout-7.8.dist-info}/METADATA +50 -29
  117. {webscout-7.7.dist-info → webscout-7.8.dist-info}/RECORD +121 -110
  118. {webscout-7.7.dist-info → webscout-7.8.dist-info}/LICENSE.md +0 -0
  119. {webscout-7.7.dist-info → webscout-7.8.dist-info}/WHEEL +0 -0
  120. {webscout-7.7.dist-info → webscout-7.8.dist-info}/entry_points.txt +0 -0
  121. {webscout-7.7.dist-info → webscout-7.8.dist-info}/top_level.txt +0 -0
@@ -34,7 +34,7 @@ import os
34
34
  import aiohttp
35
35
  import aiofiles
36
36
  import asyncio
37
- from typing import Any, List, Optional, Dict
37
+ from typing import Union, Any, List, Optional, Dict
38
38
  from webscout.AIbase import AsyncImageProvider
39
39
  from webscout.Litlogger import Logger, LogFormat
40
40
  from webscout.litagent import LitAgent
@@ -29,7 +29,7 @@ import os
29
29
  import requests
30
30
  import io
31
31
  from PIL import Image
32
- from typing import Any, List, Optional, Dict
32
+ from typing import Union, Any, List, Optional, Dict
33
33
  from webscout.AIbase import ImageProvider
34
34
  from webscout.Litlogger import Logger, LogFormat
35
35
  from webscout.litagent import LitAgent
@@ -1,23 +1,23 @@
1
- """PiclumenImager Provider Package - Your go-to for high-quality AI art! 🎨
2
-
3
- Examples:
4
- >>> # Synchronous usage
5
- >>> from webscout import PiclumenImager
6
- >>> provider = PiclumenImager()
7
- >>> images = provider.generate("A cool underwater creature")
8
- >>> provider.save(images, dir="my_images")
9
- >>>
10
- >>> # Asynchronous usage
11
- >>> import asyncio
12
- >>> from webscout import AsyncPiclumenImager
13
- >>> async def main():
14
- ... provider = AsyncPiclumenImager()
15
- ... images = await provider.generate("A cool cyberpunk city")
16
- ... await provider.save(images, dir="my_images")
17
- >>> asyncio.run(main())
18
- """
19
-
20
- from .sync_piclumen import PiclumenImager
21
- from .async_piclumen import AsyncPiclumenImager
22
-
1
+ """PiclumenImager Provider Package - Your go-to for high-quality AI art! 🎨
2
+
3
+ Examples:
4
+ >>> # Synchronous usage
5
+ >>> from webscout import PiclumenImager
6
+ >>> provider = PiclumenImager()
7
+ >>> images = provider.generate("A cool underwater creature")
8
+ >>> provider.save(images, dir="my_images")
9
+ >>>
10
+ >>> # Asynchronous usage
11
+ >>> import asyncio
12
+ >>> from webscout import AsyncPiclumenImager
13
+ >>> async def main():
14
+ ... provider = AsyncPiclumenImager()
15
+ ... images = await provider.generate("A cool cyberpunk city")
16
+ ... await provider.save(images, dir="my_images")
17
+ >>> asyncio.run(main())
18
+ """
19
+
20
+ from .sync_piclumen import PiclumenImager
21
+ from .async_piclumen import AsyncPiclumenImager
22
+
23
23
  __all__ = ["PiclumenImager", "AsyncPiclumenImager"]
@@ -1,233 +1,233 @@
1
- """PiclumenImager Synchronous Provider - Your go-to for high-quality AI art! 🔥
2
-
3
- Examples:
4
- >>> from webscout import PiclumenImager
5
- >>> provider = PiclumenImager()
6
- >>>
7
- >>> # Generate a single image
8
- >>> images = provider.generate("A cool cyberpunk city at night")
9
- >>> provider.save(images, dir="my_images")
10
- >>>
11
- >>> # Generate multiple images with different settings
12
- >>> images = provider.generate(
13
- ... prompt="An underwater alien creature with bioluminescent features",
14
- ... amount=3
15
- ... )
16
- >>> provider.save(images, dir="creatures")
17
- """
18
-
19
- import requests
20
- import os
21
- import time
22
- import json
23
- from typing import List, Optional, Union
24
- from datetime import datetime
25
- from pathlib import Path
26
- from requests.exceptions import RequestException
27
-
28
- from webscout.AIbase import ImageProvider
29
- from webscout.litagent import LitAgent
30
-
31
- # Get a fresh user agent! 🔄
32
- agent = LitAgent()
33
-
34
- class PiclumenImager(ImageProvider):
35
- """Your homie for generating fire images using Piclumen! 🎨
36
-
37
- This provider generates high-quality AI art with built-in retry logic
38
- and error handling to make sure you get your images no cap! 💯
39
-
40
- Examples:
41
- >>> provider = PiclumenImager()
42
- >>> # Generate one image
43
- >>> image = provider.generate("A futuristic city")
44
- >>> provider.save(image, "city.jpg")
45
- >>>
46
- >>> # Generate multiple images
47
- >>> images = provider.generate(
48
- ... prompt="Underwater alien creatures",
49
- ... amount=3
50
- ... )
51
- >>> provider.save(images, dir="ocean_creatures")
52
- """
53
-
54
- def __init__(
55
- self,
56
- timeout: int = 120,
57
- proxies: Optional[dict] = None
58
- ):
59
- """Initialize your PiclumenImager provider with custom settings
60
-
61
- Examples:
62
- >>> provider = PiclumenImager(timeout=180)
63
- >>> provider = PiclumenImager(proxies={"http": "http://proxy:8080"})
64
-
65
- Args:
66
- timeout (int): HTTP request timeout in seconds (default: 120)
67
- proxies (dict, optional): Proxy configuration for requests
68
- """
69
- self.api_endpoint = "https://s9.piclumen.art/comfy/api/generate-image"
70
- self.headers = {
71
- "Accept": "application/json",
72
- "Accept-Encoding": "gzip, deflate, br, zstd",
73
- "Accept-Language": "en-US,en;q=0.9,en-IN;q=0.8",
74
- "Content-Type": "application/json",
75
- "DNT": "1",
76
- "Origin": "https://www.piclumen.com",
77
- "Referer": "https://s9.piclumen.art/",
78
- "Sec-Ch-Ua": '"Not(A:Brand";v="99", "Microsoft Edge";v="133", "Chromium";v="133"',
79
- "Sec-Ch-Ua-Mobile": "?0",
80
- "Sec-Ch-Ua-Platform": '"Windows"',
81
- "Sec-Fetch-Dest": "empty",
82
- "Sec-Fetch-Mode": "cors",
83
- "Sec-Fetch-Site": "cross-site",
84
- "Sec-Gpc": "1",
85
- "User-Agent": agent.random(), # Using our fire random agent! 🔥
86
- }
87
- self.session = requests.Session()
88
- self.session.headers.update(self.headers)
89
- if proxies:
90
- self.session.proxies.update(proxies)
91
-
92
- self.timeout = timeout
93
- self.prompt: str = "AI-generated image - webscout"
94
- self.image_extension: str = "jpg"
95
-
96
- def generate(
97
- self,
98
- prompt: str,
99
- amount: int = 1,
100
- max_retries: int = 3,
101
- retry_delay: int = 5
102
- ) -> List[bytes]:
103
- """Generate some fire images from your prompt! 🎨
104
-
105
- Args:
106
- prompt (str): Your image description
107
- amount (int): How many images you want (default: 1)
108
- max_retries (int): Max retry attempts if something fails (default: 3)
109
- retry_delay (int): Seconds to wait between retries (default: 5)
110
-
111
- Returns:
112
- List[bytes]: Your generated images as bytes
113
-
114
- Raises:
115
- ValueError: If the inputs ain't valid
116
- RequestException: If the API calls fail after retries
117
- """
118
- # Input validation
119
- if not prompt:
120
- raise ValueError("Yo fam, the prompt can't be empty! 🤔")
121
- if not isinstance(amount, int) or amount < 1:
122
- raise ValueError("Amount needs to be a positive number! 📈")
123
-
124
- self.prompt = prompt
125
- response = []
126
-
127
- # Payload with the prompt
128
- payload = {
129
- "prompt": prompt
130
- }
131
-
132
- for i in range(amount):
133
- for attempt in range(max_retries):
134
- try:
135
- resp = self.session.post(
136
- self.api_endpoint,
137
- json=payload,
138
- timeout=self.timeout
139
- )
140
- resp.raise_for_status()
141
-
142
- # Check if response is an image
143
- if resp.headers.get('content-type') == 'image/jpeg':
144
- response.append(resp.content)
145
- break
146
- else:
147
- if attempt == max_retries - 1:
148
- raise RequestException(f"API returned non-image content: {resp.text[:100]}")
149
-
150
- except RequestException as e:
151
- if attempt == max_retries - 1:
152
- raise
153
- time.sleep(retry_delay)
154
-
155
- return response
156
-
157
- def save(
158
- self,
159
- response: List[bytes],
160
- name: Optional[str] = None,
161
- dir: Optional[Union[str, Path]] = None,
162
- filenames_prefix: str = "",
163
- ) -> List[str]:
164
- """Save your fire generated images! 💾
165
-
166
- Examples:
167
- >>> provider = PiclumenImager()
168
- >>> images = provider.generate("Cool art")
169
- >>> # Save with default settings
170
- >>> paths = provider.save(images)
171
- >>> # Save with custom name and directory
172
- >>> paths = provider.save(
173
- ... images,
174
- ... name="my_art",
175
- ... dir="my_images",
176
- ... filenames_prefix="test_"
177
- ... )
178
-
179
- Args:
180
- response (List[bytes]): Your generated images
181
- name (Optional[str]): Custom name for your images
182
- dir (Optional[Union[str, Path]]): Where to save the images (default: current directory)
183
- filenames_prefix (str): Prefix for your image files
184
-
185
- Returns:
186
- List[str]: Paths to your saved images
187
- """
188
- save_dir = dir if dir else os.getcwd()
189
- if not os.path.exists(save_dir):
190
- os.makedirs(save_dir)
191
-
192
- saved_paths = []
193
- timestamp = int(time.time())
194
-
195
- # Clean up name for filename use
196
- safe_name = ""
197
- if name:
198
- safe_name = "".join(c if c.isalnum() or c in "_-" else "_" for c in name)
199
-
200
- # Use prompt-based name if no name is provided
201
- if not safe_name and self.prompt:
202
- # Clean and truncate prompt for filename
203
- prompt_words = self.prompt.split()[:5] # First 5 words
204
- safe_name = "_".join("".join(c if c.isalnum() else "_" for c in word) for word in prompt_words).lower()
205
-
206
- for i, image_bytes in enumerate(response):
207
- if safe_name:
208
- filename = f"{filenames_prefix}{safe_name}_{i}.{self.image_extension}"
209
- else:
210
- filename = f"{filenames_prefix}piclumen_{timestamp}_{i}.{self.image_extension}"
211
-
212
- filepath = os.path.join(save_dir, filename)
213
-
214
- with open(filepath, "wb") as f:
215
- f.write(image_bytes)
216
-
217
- saved_paths.append(filepath)
218
-
219
- return saved_paths
220
-
221
-
222
- if __name__ == "__main__":
223
- # Example usage
224
- provider = PiclumenImager()
225
- try:
226
- images = provider.generate(
227
- prompt="underwater macro photography, alien-like sea creature, translucent body, feathery appendages, glowing orbs, bioluminescent, ethereal, surreal",
228
- amount=1
229
- )
230
- paths = provider.save(images, dir="generated_images")
231
- print(f"Successfully saved images to: {paths}")
232
- except Exception as e:
1
+ """PiclumenImager Synchronous Provider - Your go-to for high-quality AI art! 🔥
2
+
3
+ Examples:
4
+ >>> from webscout import PiclumenImager
5
+ >>> provider = PiclumenImager()
6
+ >>>
7
+ >>> # Generate a single image
8
+ >>> images = provider.generate("A cool cyberpunk city at night")
9
+ >>> provider.save(images, dir="my_images")
10
+ >>>
11
+ >>> # Generate multiple images with different settings
12
+ >>> images = provider.generate(
13
+ ... prompt="An underwater alien creature with bioluminescent features",
14
+ ... amount=3
15
+ ... )
16
+ >>> provider.save(images, dir="creatures")
17
+ """
18
+
19
+ import requests
20
+ import os
21
+ import time
22
+ import json
23
+ from typing import List, Optional, Union
24
+ from datetime import datetime
25
+ from pathlib import Path
26
+ from requests.exceptions import RequestException
27
+
28
+ from webscout.AIbase import ImageProvider
29
+ from webscout.litagent import LitAgent
30
+
31
+ # Get a fresh user agent! 🔄
32
+ agent = LitAgent()
33
+
34
+ class PiclumenImager(ImageProvider):
35
+ """Your homie for generating fire images using Piclumen! 🎨
36
+
37
+ This provider generates high-quality AI art with built-in retry logic
38
+ and error handling to make sure you get your images no cap! 💯
39
+
40
+ Examples:
41
+ >>> provider = PiclumenImager()
42
+ >>> # Generate one image
43
+ >>> image = provider.generate("A futuristic city")
44
+ >>> provider.save(image, "city.jpg")
45
+ >>>
46
+ >>> # Generate multiple images
47
+ >>> images = provider.generate(
48
+ ... prompt="Underwater alien creatures",
49
+ ... amount=3
50
+ ... )
51
+ >>> provider.save(images, dir="ocean_creatures")
52
+ """
53
+
54
+ def __init__(
55
+ self,
56
+ timeout: int = 120,
57
+ proxies: Optional[dict] = None
58
+ ):
59
+ """Initialize your PiclumenImager provider with custom settings
60
+
61
+ Examples:
62
+ >>> provider = PiclumenImager(timeout=180)
63
+ >>> provider = PiclumenImager(proxies={"http": "http://proxy:8080"})
64
+
65
+ Args:
66
+ timeout (int): HTTP request timeout in seconds (default: 120)
67
+ proxies (dict, optional): Proxy configuration for requests
68
+ """
69
+ self.api_endpoint = "https://s9.piclumen.art/comfy/api/generate-image"
70
+ self.headers = {
71
+ "Accept": "application/json",
72
+ "Accept-Encoding": "gzip, deflate, br, zstd",
73
+ "Accept-Language": "en-US,en;q=0.9,en-IN;q=0.8",
74
+ "Content-Type": "application/json",
75
+ "DNT": "1",
76
+ "Origin": "https://www.piclumen.com",
77
+ "Referer": "https://s9.piclumen.art/",
78
+ "Sec-Ch-Ua": '"Not(A:Brand";v="99", "Microsoft Edge";v="133", "Chromium";v="133"',
79
+ "Sec-Ch-Ua-Mobile": "?0",
80
+ "Sec-Ch-Ua-Platform": '"Windows"',
81
+ "Sec-Fetch-Dest": "empty",
82
+ "Sec-Fetch-Mode": "cors",
83
+ "Sec-Fetch-Site": "cross-site",
84
+ "Sec-Gpc": "1",
85
+ "User-Agent": agent.random(), # Using our fire random agent! 🔥
86
+ }
87
+ self.session = requests.Session()
88
+ self.session.headers.update(self.headers)
89
+ if proxies:
90
+ self.session.proxies.update(proxies)
91
+
92
+ self.timeout = timeout
93
+ self.prompt: str = "AI-generated image - webscout"
94
+ self.image_extension: str = "jpg"
95
+
96
+ def generate(
97
+ self,
98
+ prompt: str,
99
+ amount: int = 1,
100
+ max_retries: int = 3,
101
+ retry_delay: int = 5
102
+ ) -> List[bytes]:
103
+ """Generate some fire images from your prompt! 🎨
104
+
105
+ Args:
106
+ prompt (str): Your image description
107
+ amount (int): How many images you want (default: 1)
108
+ max_retries (int): Max retry attempts if something fails (default: 3)
109
+ retry_delay (int): Seconds to wait between retries (default: 5)
110
+
111
+ Returns:
112
+ List[bytes]: Your generated images as bytes
113
+
114
+ Raises:
115
+ ValueError: If the inputs ain't valid
116
+ RequestException: If the API calls fail after retries
117
+ """
118
+ # Input validation
119
+ if not prompt:
120
+ raise ValueError("Yo fam, the prompt can't be empty! 🤔")
121
+ if not isinstance(amount, int) or amount < 1:
122
+ raise ValueError("Amount needs to be a positive number! 📈")
123
+
124
+ self.prompt = prompt
125
+ response = []
126
+
127
+ # Payload with the prompt
128
+ payload = {
129
+ "prompt": prompt
130
+ }
131
+
132
+ for i in range(amount):
133
+ for attempt in range(max_retries):
134
+ try:
135
+ resp = self.session.post(
136
+ self.api_endpoint,
137
+ json=payload,
138
+ timeout=self.timeout
139
+ )
140
+ resp.raise_for_status()
141
+
142
+ # Check if response is an image
143
+ if resp.headers.get('content-type') == 'image/jpeg':
144
+ response.append(resp.content)
145
+ break
146
+ else:
147
+ if attempt == max_retries - 1:
148
+ raise RequestException(f"API returned non-image content: {resp.text[:100]}")
149
+
150
+ except RequestException as e:
151
+ if attempt == max_retries - 1:
152
+ raise
153
+ time.sleep(retry_delay)
154
+
155
+ return response
156
+
157
+ def save(
158
+ self,
159
+ response: List[bytes],
160
+ name: Optional[str] = None,
161
+ dir: Optional[Union[str, Path]] = None,
162
+ filenames_prefix: str = "",
163
+ ) -> List[str]:
164
+ """Save your fire generated images! 💾
165
+
166
+ Examples:
167
+ >>> provider = PiclumenImager()
168
+ >>> images = provider.generate("Cool art")
169
+ >>> # Save with default settings
170
+ >>> paths = provider.save(images)
171
+ >>> # Save with custom name and directory
172
+ >>> paths = provider.save(
173
+ ... images,
174
+ ... name="my_art",
175
+ ... dir="my_images",
176
+ ... filenames_prefix="test_"
177
+ ... )
178
+
179
+ Args:
180
+ response (List[bytes]): Your generated images
181
+ name (Optional[str]): Custom name for your images
182
+ dir (Optional[Union[str, Path]]): Where to save the images (default: current directory)
183
+ filenames_prefix (str): Prefix for your image files
184
+
185
+ Returns:
186
+ List[str]: Paths to your saved images
187
+ """
188
+ save_dir = dir if dir else os.getcwd()
189
+ if not os.path.exists(save_dir):
190
+ os.makedirs(save_dir)
191
+
192
+ saved_paths = []
193
+ timestamp = int(time.time())
194
+
195
+ # Clean up name for filename use
196
+ safe_name = ""
197
+ if name:
198
+ safe_name = "".join(c if c.isalnum() or c in "_-" else "_" for c in name)
199
+
200
+ # Use prompt-based name if no name is provided
201
+ if not safe_name and self.prompt:
202
+ # Clean and truncate prompt for filename
203
+ prompt_words = self.prompt.split()[:5] # First 5 words
204
+ safe_name = "_".join("".join(c if c.isalnum() else "_" for c in word) for word in prompt_words).lower()
205
+
206
+ for i, image_bytes in enumerate(response):
207
+ if safe_name:
208
+ filename = f"{filenames_prefix}{safe_name}_{i}.{self.image_extension}"
209
+ else:
210
+ filename = f"{filenames_prefix}piclumen_{timestamp}_{i}.{self.image_extension}"
211
+
212
+ filepath = os.path.join(save_dir, filename)
213
+
214
+ with open(filepath, "wb") as f:
215
+ f.write(image_bytes)
216
+
217
+ saved_paths.append(filepath)
218
+
219
+ return saved_paths
220
+
221
+
222
+ if __name__ == "__main__":
223
+ # Example usage
224
+ provider = PiclumenImager()
225
+ try:
226
+ images = provider.generate(
227
+ prompt="underwater macro photography, alien-like sea creature, translucent body, feathery appendages, glowing orbs, bioluminescent, ethereal, surreal",
228
+ amount=1
229
+ )
230
+ paths = provider.save(images, dir="generated_images")
231
+ print(f"Successfully saved images to: {paths}")
232
+ except Exception as e:
233
233
  print(f"Oops, something went wrong: {e}")
@@ -0,0 +1,4 @@
1
+ from .sync_pixelmuse import PixelMuseImager
2
+ from .async_pixelmuse import AsyncPixelMuseImager
3
+
4
+ __all__ = ['PixelMuseImager', 'AsyncPixelMuseImager']