HappyAccidentsAPI
At the moment, HappyAccidents has not provided an official API and the library is built on the basis of the client API. Because of this, you may find bugs and shortcomings, if this happened, please provide a report in Issues.
Quick example
import asyncio
from happyaccidentsapi import ClientAPI
from happyaccidentsapi.models import CreateInferenceParams
async def main():
api = ClientAPI(token="...")
model = (await api.fetch_metadata_items("Stable Diffusion v1.5")).first()
inference_params = CreateInferenceParams(
modelId=model.id,
prompt="Beautiful girl on the beach",
numImagesToGenerate=5,
)
inference = await api.create_inference(inference_params) # <InferenceHistoricalResult ...>
for image in inference.images: # [<ImageRecord ...>, ...]
print(image.get_url()) # https://https://ik.imagekit.io/.../result-4.png
await image.save(f"./images/{image.id}-{image.filename}")
if __name__ == "__main__":
asyncio.run(main())
NOTE: It is not advised to leave your token directly in your code, as it allows anyone with it to access your account. If you intend to make your code public you should store it securely.
Links
Metadata
Release files for happyaccidentsapi 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| happyaccidentsapi-0.0.3.tar.gz | 12.6 kB | Without provenance | Details for happyaccidentsapi-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| happyaccidentsapi-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for happyaccidentsapi-0.0.3-py3-none-any.whl |
Total release size: 26.1 kB
Release files / happyaccidentsapi-0.0.3.tar.gz
| Download URL | happyaccidentsapi-0.0.3.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20b19ac87292e158099527b7ea5e023ff5f68adfeb41df604537d8993511d1ca
|
|
BLAKE2b-256 checksum How to use checksums |
ee7cd4d8ab280e8c7996b846bd3fa3a261d13a7a390fc384dffcb6a16cb1825a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.3 Linux/6.4.4-arch1-1
|
Release files / happyaccidentsapi-0.0.3-py3-none-any.whl
| Download URL | happyaccidentsapi-0.0.3-py3-none-any.whl |
|---|---|
| Size | 13.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8b403b30abb9b31f65945fa7dd3b854a72499563e9ad5c2ed85e61db2f92ec8e
|
|
BLAKE2b-256 checksum How to use checksums |
4b434c42544d416bae7c76e466242d527ee5c56a06d388bb59f3214d7a57c425
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.3 Linux/6.4.4-arch1-1
|
Security for happyaccidentsapi 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.