<img alt="banner" src="https://raw.githubusercontent.com/hoopengo/hoopengo/master/images/HappyAccidentsAPI/banner-light.svg" style="max-width: 100%;">
## 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.](https://github.com/hoopengo/HappyAccidentsAPI/issues)
## Quick example
```python
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
- [Repository](https://github.com/hoopengo/HappyAccidentsAPI)
- [Documentation](https://github.com/hoopengo/HappyAccidentsAPI/tree/master/docs/)
- [Examples](https://github.com/hoopengo/HappyAccidentsAPI/tree/master/examples/)
- [How to get token?](https://github.com/hoopengo/HappyAccidentsAPI/blob/master/docs/get_token.md)
[//]: <- [Try it Out](https://t.me/HotBebrasBot)>
Raw data
{
"_id": null,
"home_page": "https://github.com/hoopengo/happyaccidentsapi",
"name": "happyaccidentsapi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "api,happyaccidents,ai",
"author": "hoopengo",
"author_email": "hoopengo@yandex.ru",
"download_url": "https://files.pythonhosted.org/packages/ee/7c/d4d8ab280e8c7996b846bd3fa3a261d13a7a390fc384dffcb6a16cb1825a/happyaccidentsapi-0.0.3.tar.gz",
"platform": null,
"description": "<img alt=\"banner\" src=\"https://raw.githubusercontent.com/hoopengo/hoopengo/master/images/HappyAccidentsAPI/banner-light.svg\" style=\"max-width: 100%;\">\n\n## HappyAccidentsAPI\n\n> 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.](https://github.com/hoopengo/HappyAccidentsAPI/issues)\n\n## Quick example\n\n```python\nimport asyncio\n\nfrom happyaccidentsapi import ClientAPI\nfrom happyaccidentsapi.models import CreateInferenceParams\n\n\nasync def main():\n api = ClientAPI(token=\"...\")\n model = (await api.fetch_metadata_items(\"Stable Diffusion v1.5\")).first()\n\n inference_params = CreateInferenceParams(\n modelId=model.id,\n prompt=\"Beautiful girl on the beach\",\n numImagesToGenerate=5,\n )\n\n inference = await api.create_inference(inference_params) # <InferenceHistoricalResult ...>\n for image in inference.images: # [<ImageRecord ...>, ...]\n print(image.get_url()) # https://https://ik.imagekit.io/.../result-4.png\n await image.save(f\"./images/{image.id}-{image.filename}\")\n\n\nif __name__ == \"__main__\":\n asyncio.run(main())\n```\n\nNOTE: 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.\n\n## Links\n\n- [Repository](https://github.com/hoopengo/HappyAccidentsAPI)\n- [Documentation](https://github.com/hoopengo/HappyAccidentsAPI/tree/master/docs/)\n- [Examples](https://github.com/hoopengo/HappyAccidentsAPI/tree/master/examples/)\n- [How to get token?](https://github.com/hoopengo/HappyAccidentsAPI/blob/master/docs/get_token.md)\n\n[//]: <- [Try it Out](https://t.me/HotBebrasBot)>\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "API Wrapper for HappyAccidents",
"version": "0.0.3",
"project_urls": {
"Homepage": "https://github.com/hoopengo/happyaccidentsapi",
"Repository": "https://github.com/hoopengo/happyaccidentsapi"
},
"split_keywords": [
"api",
"happyaccidents",
"ai"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "4b434c42544d416bae7c76e466242d527ee5c56a06d388bb59f3214d7a57c425",
"md5": "e51b972ce9b6fc1f66eb5d4580021cb6",
"sha256": "8b403b30abb9b31f65945fa7dd3b854a72499563e9ad5c2ed85e61db2f92ec8e"
},
"downloads": -1,
"filename": "happyaccidentsapi-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e51b972ce9b6fc1f66eb5d4580021cb6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 13551,
"upload_time": "2023-07-30T13:23:43",
"upload_time_iso_8601": "2023-07-30T13:23:43.022846Z",
"url": "https://files.pythonhosted.org/packages/4b/43/4c42544d416bae7c76e466242d527ee5c56a06d388bb59f3214d7a57c425/happyaccidentsapi-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ee7cd4d8ab280e8c7996b846bd3fa3a261d13a7a390fc384dffcb6a16cb1825a",
"md5": "5752be0b6e4ac2f633d654003a6b2696",
"sha256": "20b19ac87292e158099527b7ea5e023ff5f68adfeb41df604537d8993511d1ca"
},
"downloads": -1,
"filename": "happyaccidentsapi-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "5752be0b6e4ac2f633d654003a6b2696",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 12567,
"upload_time": "2023-07-30T13:23:44",
"upload_time_iso_8601": "2023-07-30T13:23:44.912182Z",
"url": "https://files.pythonhosted.org/packages/ee/7c/d4d8ab280e8c7996b846bd3fa3a261d13a7a390fc384dffcb6a16cb1825a/happyaccidentsapi-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-30 13:23:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hoopengo",
"github_project": "happyaccidentsapi",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "happyaccidentsapi"
}