Skip to main content

tags: [gradio-custom-component, SimpleTextbox] title: gradio_mycomponent short_description: hello world component colorFrom: blue colorTo: yellow sdk: gradio pinned: false app_file: space.py

gradio_mycomponent

Static Badge

hello world component

Installation

pip install gradio_mycomponent

Usage

import gradio as gr
from gradio_mycomponent import MyComponent


example = MyComponent().example_value()

demo = gr.Interface(
    lambda x:x,
    MyComponent(),  # interactive version of your component
    MyComponent(),  # static version of your component
    # examples=[[example]],  # uncomment this line to view the "example version" of your component
)


if __name__ == "__main__":
    demo.launch()

MyComponent

Initialization

name type default description
value
str | Callable | None
None default text to provide in textbox. If callable, the function will be called whenever the app loads to set the initial value of the component.
placeholder
str | None
None placeholder hint to provide behind textbox.
label
str | None
None component name in interface.
every
float | None
None If `value` is a callable, run the function 'every' number of seconds while the client connection is open. Has no effect otherwise. The event can be accessed (e.g. to cancel it) via this component's .load_event attribute.
show_label
bool | None
None if True, will display label.
scale
int | None
None relative size compared to adjacent Components. For example if Components A and B are in a Row, and A has scale=2, and B has scale=1, A will be twice as wide as B. Should be an integer. scale applies in Rows, and to top-level Components in Blocks where fill_height=True.
min_width
int
160 minimum pixel width, will wrap if not sufficient screen space to satisfy this value. If a certain scale value results in this Component being narrower than min_width, the min_width parameter will be respected first.
interactive
bool | None
None if True, will be rendered as an editable textbox; if False, editing will be disabled. If not provided, this is inferred based on whether the component is used as an input or output.
visible
bool
True If False, component will be hidden.
rtl
bool
False If True and `type` is "text", sets the direction of the text to right-to-left (cursor appears on the left of the text). Default is False, which renders cursor on the right.
elem_id
str | None
None An optional string that is assigned as the id of this component in the HTML DOM. Can be used for targeting CSS styles.
elem_classes
list[str] | str | None
None An optional list of strings that are assigned as the classes of this component in the HTML DOM. Can be used for targeting CSS styles.
render
bool
True If False, component will not render be rendered in the Blocks context. Should be used if the intention is to assign event listeners now but render the component later.

Events

name description
change Triggered when the value of the MyComponent 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 MyComponent.
submit This listener is triggered when the user presses the Enter key while the MyComponent is focused.

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, passes text value as a {str} into the function.
  • As input: Should return, expects a {str} returned from function and sets textarea value to it.
def predict(
    value: str | None
) -> str | None:
    return value

Metadata

Release files for gradio-mycomponent 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gradio-mycomponent 0.0.1
File Size Uploaded Provenance Actions
gradio_mycomponent-0.0.1.tar.gz 68.8 kB Without provenance Details for gradio_mycomponent-0.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gradio-mycomponent 0.0.1
File Interpreter ABI Platform Actions
gradio_mycomponent-0.0.1-py3-none-any.whl Python 3 none any Details for gradio_mycomponent-0.0.1-py3-none-any.whl

Total release size: 98.9 kB

Release files / gradio_mycomponent-0.0.1.tar.gz

Download URL gradio_mycomponent-0.0.1.tar.gz
Size 68.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7c2c0fc0cfecbc069a16be0cd9d48ef509d07cac137a6484a3bef8881e786a4d
BLAKE2b-256 checksum
How to use checksums
3013ec504b83d938f8a1d7a5c4655fb9e11e5d50b0c4695d600c5098766c0686
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.0

Release files / gradio_mycomponent-0.0.1-py3-none-any.whl

Download URL gradio_mycomponent-0.0.1-py3-none-any.whl
Size 30.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7d137990560d7eb4d08a1b98445a82471ede964e8bb12d96f4eac27026fa358e
BLAKE2b-256 checksum
How to use checksums
7c08734a4ce178aa310a7eb94b0d9fad32a5a2aeb132a0cca971fcef586ac432
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.0

Security for gradio-mycomponent 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page