-
-
Notifications
You must be signed in to change notification settings - Fork 21
Extensions
Extensions are a work in progress. Keep an eye on this page for updates on how to create extensions.
Although a previous version of AI Runner contained extensions, only a LoRA extension has been released. The decision was made to move LoRA into the AI Runner code-base and remove extensions until the extension feature is more robust and mature.
Extensions must contain a main.py
file which extends the BaseExtension
class.
Example
from airunner.extensions import BaseExtension
class Extension(BaseExtension):
...
You can modify various GUI elements by adding specific injection methods to your Extension
class.
Generator tab
refers to widget which contains all of the elements found in each generator section
Use the generator_tab_injection
function to manipulate the Generator tab
Example
def generator_tab_injection(self, tab: QWidget, tab_name: str = None):
# modifications here
...
See the LoRA extension for an extensive example
The menubar sits at the very top of the main window.
Use the menubar_injection
function to manipulate the menubar.
Example
class Extension(BaseExtension):
def menubar_injection(self, menubar: QMenu):
menubar.addMenu("Menu Example")
The toolbar sits just under the menubar and contains various buttons such as Undo and Redo.
Use the toolbar_injection
function to manipulate the toolbar.
Example
def toolbar_injection(self, toolbar: QFrame):
self.example_button = QPushButton("Button Example")
toolbar.layout().addWidget(self.example_button)
When generate is called, AI Runner passes form data from the generate tab to a class which is responsible for handling Stable Diffusion generation. The data which is passed to this class can be manipulated with the generate_data_injection
function.
Example
def generate_data_injection(self, data):
data["options"]["lora"] = []
for lora in self.available_loras(data["action"]):
if lora["enabled"]:
print(lora)
data["options"]["lora"].append((lora["name"], lora["scale"]))
return data
the call_pipe
method can be used to gain access to the stable diffusion model.
def call_pipe(self, options: dict, model_base_path: str, pipe: object, **kwargs):
...
return pipe
See the LoRA extension for an extensive example
In order to submit an extension for review, send a email to [email protected] with a link to your extension on github.
- Extensions must be released on Github under the AGPL-3.0 license.
- A setup.py file must exist in the root directory
- You must create a release
Example setup.py
setup(
name='airunner-lora',
version="1.0.0",
author="Capsize LLC",
description="LoRA extension for AI Runner",
license="AGPL-3.0",
author_email="[email protected]",
url="https://github.com/Capsize-Games/airunner-lora",
)
See the airunner-lora extension for further examples.