Python library for easily interacting with trained machine learning models
Project description
tags: [gradio-custom-component, Slider] title: gradio_automationbus short_description: colorFrom: blue colorTo: yellow sdk: gradio pinned: false app_file: space.py
gradio_automationbus
Python library for easily interacting with trained machine learning models
Installation
pip install gradio_automationbus
Usage
import gradio as gr
from gradio_automationbus import AutomationBus
def passthrough(points):
return points
with gr.Blocks() as demo:
gr.Markdown("## Automation Lane Demo")
with gr.Row():
audio = gr.Audio(label="Audio", sources=["upload", "microphone"], type="filepath")
with gr.Row():
lane = AutomationBus(
label="Automation",
x_min=0.0,
x_max=1.0,
y_min=0.0,
y_max=1.0,
top_label="prompt a",
bottom_label="prompt b",
)
# Remove waveform linkage for now
# Echo points on release
out = gr.JSON(label="Current Points")
lane.release(fn=passthrough, inputs=lane, outputs=out)
if __name__ == "__main__":
demo.launch(share=True)
AutomationBus
Initialization
| name | type | default | description |
|---|---|---|---|
value |
list[list[float]] | dict[str, Any] | Callable | None
|
None |
Initial points list ([[x, y], ...]) or an object {"points": [[x,y],...], "audio_url": str}. |
x_min |
float
|
0.0 |
Minimum x value of the canvas domain. |
x_max |
float
|
1.0 |
Maximum x value of the canvas domain. |
y_min |
float
|
0.0 |
Minimum y value of the canvas range. |
y_max |
float
|
1.0 |
Maximum y value of the canvas range. |
precision |
int | None
|
3 |
Number of decimal places to round values to when serializing. |
audio_url |
str | None
|
None |
Optional URL or path to an audio file to render waveform background. |
shade_enabled |
bool
|
True |
None |
shade_above_color |
str | None
|
"rgba(250, 204, 21, 0.25)" |
None |
shade_below_color |
str | None
|
"rgba(34, 197, 94, 0.25)" |
None |
top_label |
str | None
|
None |
None |
bottom_label |
str | None
|
None |
None |
label |
str | I18nData | None
|
None |
None |
info |
str | I18nData | None
|
None |
None |
every |
Timer | float | None
|
None |
None |
inputs |
Component | Sequence[Component] | set[Component] | None
|
None |
None |
show_label |
bool | None
|
None |
None |
container |
bool
|
True |
None |
scale |
int | None
|
None |
None |
min_width |
int
|
160 |
None |
interactive |
bool | None
|
None |
None |
visible |
bool | Literal["hidden"]
|
True |
None |
elem_id |
str | None
|
None |
None |
elem_classes |
list[str] | str | None
|
None |
None |
render |
bool
|
True |
None |
key |
int | str | tuple[int | str, ...] | None
|
None |
None |
preserved_by_key |
list[str] | str | None
|
"value" |
None |
show_reset_button |
bool
|
True |
Standard component options. |
Events
| name | description |
|---|---|
change |
Triggered when the value of the AutomationBus changes either because of user input (e.g. a user types in a textbox) OR because of a function update (e.g. an image receives a value from the output of an event trigger). See .input() for a listener that is only triggered by user input. |
input |
This listener is triggered when the user changes the value of the AutomationBus. |
release |
This listener is triggered when the user releases the mouse on this AutomationBus. |
User function
The impact on the users predict function varies depending on whether the component is used as an input or output for an event (or both).
- When used as an Input, the component only impacts the input signature of the user function.
- When used as an output, the component only impacts the return signature of the user function.
The code snippet below is accurate in cases where the component is used as both an input and an output.
- As output: Is passed, the validated and rounded list of points.
def predict(
value: list[list[float]]
) -> typing.Any:
return value
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gradio_automationbus-0.0.1.tar.gz.
File metadata
- Download URL: gradio_automationbus-0.0.1.tar.gz
- Upload date:
- Size: 2.0 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9023c067fd8008c786831911a82e24a90eb05eaef6261ec405f3c92dd297789d
|
|
| MD5 |
46cfa13d4fd53c3bdacdbdbd53555abf
|
|
| BLAKE2b-256 |
ef44efff07cc627ca80d45bb7d486b6aed07767ea8b87a9636e8a032b4a3f584
|
File details
Details for the file gradio_automationbus-0.0.1-py3-none-any.whl.
File metadata
- Download URL: gradio_automationbus-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c35dd1b08bd47ca803f52b2cb076475cf82a22375f2be86265f1226adaa3b12
|
|
| MD5 |
de1456c1a4c28ad4c20a39f8eafb1558
|
|
| BLAKE2b-256 |
54b553dc20af348bc7601217ba9a6f0767bee4eadc9fa4d3863c63e1e35c1004
|