This project has been archived by its maintainers, and is no longer receiving any updates.
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:
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:
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.
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.
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
Metadata
Release files for onlyfakes 1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| onlyfakes-1.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| onlyfakes-1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / onlyfakes-1.tar.gz
| Download URL | onlyfakes-1.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c9dd729c38de17b05074801a959b9fd8bdfed796b5b1636ad3cda9d923b62dd
|
|
BLAKE2b-256 checksum How to use checksums |
6662c376305d19e79fba50f4e901d58ad43b9ffbe41eeb1838f5ccacb3507841
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / onlyfakes-1-py3-none-any.whl
| Download URL | onlyfakes-1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd072adada3279eef9d432409712bcbb986714c2ce5e6880fb2862a0ce8f046f
|
|
BLAKE2b-256 checksum How to use checksums |
e48b64128720fdce0d09b78c7368c8a780fd342951fd51ff143f33a1d8cd5ba2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|