Gradio custom navbar component
Project description
tags: [gradio-custom-component, SimpleTextbox, gradio, navbar, navar-component, gradio-navbar, UI-component] title: gradio_navbar short_description: Gradio custom navbar component colorFrom: blue colorTo: yellow sdk: gradio pinned: false app_file: space.py
gradio_navbar
Gradio custom navbar component
Installation
pip install gradio_navbar
Usage
"""
Demo for the NavBar component.
"""
import gradio as gr
from gradio_navbar import NavBar
example = NavBar().example_value()
demo = gr.Interface(
lambda x: x,
[
NavBar(
value={
"company_logo_url": "https://avatars.githubusercontent.com/u/\
55248617?v=4",
"company_name": "Gradio",
"logout_link": "https://www.gradio.app",
"username": "gradio",
"profile_photo_url": "https://avatars.githubusercontent.com/u/\
55248607?v=4",
}
),
], # interactive version of your component
NavBar(), # static version of your component
examples=[
[example]
], # uncomment this line to view the "example version" of your component
)
if __name__ == "__main__":
demo.launch()
NavBar
Initialization
| name | type | default | description |
|---|---|---|---|
value |
Dict[str, Any] | Callable | None
|
None |
None |
every |
Timer | float | None
|
None |
Continously calls `value` to recalculate it if `value` is a function (has no effect otherwise). Can provide a Timer whose tick resets `value`, or a float that provides the regular interval for the reset Timer. |
inputs |
Component | Sequence[Component] | set[Component] | None
|
None |
Components that are used as inputs to calculate `value` if `value` is a function (has no effect otherwise). `value` is recalculated any time the inputs change. |
visible |
bool
|
True |
If False, component will be hidden. |
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. |
key |
int | str | None
|
None |
if assigned, will be used to assume identity across a re-render. Components that have the same key across a re-render will have their value preserved. |
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: typing.Optional[typing.Dict[str, typing.Any]][
typing.Dict[str, typing.Any][str, typing.Any], None
]
) -> typing.Optional[typing.Dict[str, typing.Any]][
typing.Dict[str, typing.Any][str, typing.Any], None
]:
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
gradio_navbar-0.0.1.tar.gz
(1.2 MB
view details)
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