That is what this repo/ script is aimed to do.
- Install python version 3.11.9 and latest git in your computer.
Also has been tested on Python 3.11.7 and 3.9.2 - Launch terminal and test your installed python and git version.
python -V
# the output should be
# Python 3.11.9
git -v
# the output should be
# git version <version_number>.<platform>
- Git clone this repository
git clone https://github.com/HaiziIzzudin/nolimit-genai-img.git
- Change your working directory to cloned repository
cd nolimit-genai-img
- Create python virtual environment
python -m venv venv
- Launch python virtual environment
./venv/Scripts/activate
# There should be an indication that you are currently in a venv. Example:
# (venv) $
- Install all required module for this script
pip install -r requirements.txt
# some fastapi components may failed to install. PLease install it manually:
pip install fastapi "fastapi[all]" fastapi-cli
-
Edit config.toml file included in the repository. Please follow the instructions written in config.toml or script will fail!.
-
Run inference. There are two modes that you can run, (a) API Mode, and (b) WebDriver Mode:
a. API Mode (faster, but inference may fail and prone to API blocking)
Please Read This before begin API Modepython ./hf_api.py
b. WebDriver Mode (slower, but more reliable and can interact even if script is quit unexpectedly)
Please Read This before begin WebDriver Modepython ./hf_selenium.py
-
Now we wait.
-
If image has successfully generated, script wil quit with no error, or if your config.toml configuration is to come by, should also launch your file explorer to the output folder.
.
.
We uses the HuggingFace (HF) inference API, which is publicly available and accessible through Gradio, Warm Inference API or Selenium. The catch is that it's a free service, which means there are limits to how much you can use it. To get around these limits, we use a proxy. This method works pretty well, but it's not perfect. Sometimes it can take a while to get results, especially if a lot of people are using it at the same time and HF starts rate-limiting the proxies. And if HF goes down or decides to shut off their API, our script will stop working. We'll keep an eye on things and update our method if we need to.
It is recommended to provide your own HF token, since that is also has free generation.
Sometimes, it's just easier to pay for a service, and we're actually working on a paid image generation method that we think will be a good value. We'll let you know when it's ready.
One important thing to keep in mind, don't even think about using this method to offer paid services. That's NOT ALLOWED and is basically reselling something that's supposed to be free.
.
.
Support my software development on Ko-Fi
.
.