Skip to main content

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

Static Badge Static Badge

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gradio_navbar-0.0.1-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file gradio_navbar-0.0.1.tar.gz.

File metadata

  • Download URL: gradio_navbar-0.0.1.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for gradio_navbar-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5e58fab12349c5ed44373a21ec0e7a761047dfcfff904e809a4935c3676ca270
MD5 dea2ce77dcd16d5d1a93e98d95b78da2
BLAKE2b-256 60133186d17c3634ab3a049bad628eec112f5e537a369e686034f8275c710303

See more details on using hashes here.

File details

Details for the file gradio_navbar-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gradio_navbar-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for gradio_navbar-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8cfc1b7fba2b3c188e32c51a5f6ad65990abe99675bf7b5400cb81a13908e64
MD5 72f851e5dc13dce8eff90481181cec34
BLAKE2b-256 74ed0ceea9d096f5262219451124ffe2eb90e44aa9397248eb7793e2ff2e4c7c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page