# Onlyfakes API
An API wrapper for the onlyfakes website made in python.
Is able to create prompts, submit them and fetch their results.
License: MIT - See the `LICENSE` file.
# Installation
- Install with pip: `pip install onlyfakes`
- Install locally from github: `pip install git+https://github.com/Egsagon/onlyfakes-api.git`
# Usage
Example classic usage:
```python
import onlyfakes as of
# Initialise the session
client = of.Client()
# Create a new prompt
prompt = of.Prompt(
positive = '<insert positive prompt>',
negative = '<insert negative prompt>',
engine = of.Engine.hentai_HD
# Advanced settings
width = 512,
height = 640,
cfg = 7.5,
seed = of.Seed( 12345678 )
)
# Submit the prompt and wait for it to process
img = client.generate(prompt)
# Download the image at a specific path
img.download('result.png')
```
Other example using shorthands:
```python
import onlyfakes as of
of.Client().new(prompt = '<fill>', negative_prompt = '<fill>', engine = of.Engine.hentai_HD).generate().download('result.png')
```
The `generate` method contains a loop that breaks when it get a result. You can change its interaction intervals and
maximum by specifying them as arguments. You can also enable verbose to see the current process evolution.
```python
prompt.generate(
interval = 2 * 60,
timeout = 4 * 60,
verbose = True
)
```
If want async or stuff that runs in parallel, you can use the `submit` function that will only send your prompt to the backend.
You will then be able to fetch the image using the `check` method. You can also build your async function.
```python
response = client.submit(prompt)
# Do stuff for 2 min ...
data = client.check()
if data == False: ... # The backend has not finished yet
# Create the image object from data url
image = of.Image( data['imageUrl'] )
```
## TODO
- Async stuff
- Account handling
- Presets
Raw data
{
"_id": null,
"home_page": "https://github.com/Egsagon/onlyfakes-api",
"name": "onlyfakes",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": "",
"keywords": "",
"author": "Egsagon",
"author_email": "egsagon12@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/66/62/c376305d19e79fba50f4e901d58ad43b9ffbe41eeb1838f5ccacb3507841/onlyfakes-1.tar.gz",
"platform": "unix",
"description": "# Onlyfakes API\n\nAn API wrapper for the onlyfakes website made in python.\n\nIs able to create prompts, submit them and fetch their results.\n\nLicense: MIT - See the `LICENSE` file.\n\n# Installation\n\n- Install with pip: `pip install onlyfakes`\n- Install locally from github: `pip install git+https://github.com/Egsagon/onlyfakes-api.git`\n\n# Usage\n\nExample classic usage:\n```python\nimport onlyfakes as of\n\n# Initialise the session\nclient = of.Client()\n\n# Create a new prompt\nprompt = of.Prompt(\n positive = '<insert positive prompt>',\n negative = '<insert negative prompt>',\n engine = of.Engine.hentai_HD\n\n # Advanced settings\n width = 512,\n height = 640,\n cfg = 7.5,\n seed = of.Seed( 12345678 )\n)\n\n# Submit the prompt and wait for it to process\nimg = client.generate(prompt)\n\n# Download the image at a specific path\nimg.download('result.png')\n```\n\nOther example using shorthands:\n```python\nimport onlyfakes as of\n\nof.Client().new(prompt = '<fill>', negative_prompt = '<fill>', engine = of.Engine.hentai_HD).generate().download('result.png')\n```\n\nThe `generate` method contains a loop that breaks when it get a result. You can change its interaction intervals and\nmaximum by specifying them as arguments. You can also enable verbose to see the current process evolution.\n```python\nprompt.generate(\n interval = 2 * 60,\n timeout = 4 * 60,\n verbose = True\n)\n```\n\nIf want async or stuff that runs in parallel, you can use the `submit` function that will only send your prompt to the backend.\nYou will then be able to fetch the image using the `check` method. You can also build your async function.\n\n```python\nresponse = client.submit(prompt)\n\n# Do stuff for 2 min ... \n\ndata = client.check()\n\nif data == False: ... # The backend has not finished yet\n\n# Create the image object from data url\nimage = of.Image( data['imageUrl'] )\n```\n\n## TODO\n\n- Async stuff\n- Account handling\n- Presets\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "An API wrapper for Onlyfakes",
"version": "1",
"project_urls": {
"Homepage": "https://github.com/Egsagon/onlyfakes-api"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e48b64128720fdce0d09b78c7368c8a780fd342951fd51ff143f33a1d8cd5ba2",
"md5": "7465f8a7ba46d8808656018966055354",
"sha256": "bd072adada3279eef9d432409712bcbb986714c2ce5e6880fb2862a0ce8f046f"
},
"downloads": -1,
"filename": "onlyfakes-1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7465f8a7ba46d8808656018966055354",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 6139,
"upload_time": "2023-05-07T09:48:01",
"upload_time_iso_8601": "2023-05-07T09:48:01.448738Z",
"url": "https://files.pythonhosted.org/packages/e4/8b/64128720fdce0d09b78c7368c8a780fd342951fd51ff143f33a1d8cd5ba2/onlyfakes-1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6662c376305d19e79fba50f4e901d58ad43b9ffbe41eeb1838f5ccacb3507841",
"md5": "efba533069276830c32d0b6a7863cc41",
"sha256": "3c9dd729c38de17b05074801a959b9fd8bdfed796b5b1636ad3cda9d923b62dd"
},
"downloads": -1,
"filename": "onlyfakes-1.tar.gz",
"has_sig": false,
"md5_digest": "efba533069276830c32d0b6a7863cc41",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 5747,
"upload_time": "2023-05-07T09:48:02",
"upload_time_iso_8601": "2023-05-07T09:48:02.732634Z",
"url": "https://files.pythonhosted.org/packages/66/62/c376305d19e79fba50f4e901d58ad43b9ffbe41eeb1838f5ccacb3507841/onlyfakes-1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-07 09:48:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Egsagon",
"github_project": "onlyfakes-api",
"github_not_found": true,
"lcname": "onlyfakes"
}