An API wrapper for Onlyfakes
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file onlyfakes-1.tar.gz
.
File metadata
- Download URL: onlyfakes-1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3c9dd729c38de17b05074801a959b9fd8bdfed796b5b1636ad3cda9d923b62dd |
|
MD5 | efba533069276830c32d0b6a7863cc41 |
|
BLAKE2b-256 | 6662c376305d19e79fba50f4e901d58ad43b9ffbe41eeb1838f5ccacb3507841 |
File details
Details for the file onlyfakes-1-py3-none-any.whl
.
File metadata
- Download URL: onlyfakes-1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd072adada3279eef9d432409712bcbb986714c2ce5e6880fb2862a0ce8f046f |
|
MD5 | 7465f8a7ba46d8808656018966055354 |
|
BLAKE2b-256 | e48b64128720fdce0d09b78c7368c8a780fd342951fd51ff143f33a1d8cd5ba2 |