Skip to main content

Python library for easily interacting with trained machine learning models

Project description

gradio_browser

Static Badge

Python library for easily interacting with trained machine learning models

Installation

pip install gradio_browser

Usage

import gradio as gr
from gradio_browser import Browser

with gr.Blocks() as demo:
    browser = Browser(value="https://example.com", show_hostname=True)
    browser.change(lambda x: x, browser, browser)


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

Browser

Initialization

name type default description
value
str | Callable | None
None URL to display in the browser iframe
url
str
"https://example.com" Initial URL to load in the browser
width
str
"100%" Width of the browser component
height
str
"600px" Height of the browser component
show_hostname
bool
False If True, shows full URL in address bar; if False, shows only path
placeholder
str | None
None placeholder hint to provide behind textbox.
label
str | I18nData | None
None the label for this component
every
Timer | float | None
None Continously calls `value` to recalculate it if `value` is a function
inputs
Component | Sequence[Component] | set[Component] | None
None Components that are used as inputs to calculate `value` if `value` is a function
show_label
bool | None
None if True, will display label.
scale
int | None
None relative size compared to adjacent Components
min_width
int
160 minimum pixel width
interactive
bool | None
None if True, will be rendered as an editable component
visible
bool | Literal["hidden"]
True If False, component will be hidden
rtl
bool
False If True, sets the direction of the text to right-to-left
elem_id
str | None
None An optional string that is assigned as the id of this component in the HTML DOM
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
render
bool
True If False, component will not render be rendered in the Blocks context
key
int | str | tuple[int | str, ...] | None
None in a gr.render, Components with the same key across re-renders are treated as the same component
preserved_by_key
list[str] | str | None
"value" A list of parameters from this component's constructor

Events

name description
change Triggered when the value of the Browser 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 Browser.
submit This listener is triggered when the user presses the Enter key while the Browser 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 URL value as a {str} into the function.
  • As input: Should return, expects a URL {str} to display in browser.
def predict(
    value: str | None
) -> str | 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_browser-0.0.1.tar.gz (173.8 kB view details)

Uploaded Source

Built Distribution

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

gradio_browser-0.0.1-py3-none-any.whl (89.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gradio_browser-0.0.1.tar.gz
  • Upload date:
  • Size: 173.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for gradio_browser-0.0.1.tar.gz
Algorithm Hash digest
SHA256 856b5ea3963b09727984010c98765eaf00aa80460bd737509a50f06d5e17b507
MD5 2e254c9f7803a5862bf5ae956a6aaf05
BLAKE2b-256 bdaec75b0a6612fdf028c5770d70707923dd9998e7eaf81f632b90cd1f340fc0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gradio_browser-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 89.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for gradio_browser-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95e52d48882302bdcc1a0bc3ed5d2c2f91e19dfff18923a9cf308611edb6c5d6
MD5 6e2a6a40801ae54535d823f4dd88c123
BLAKE2b-256 38c57d4f47ab9be033425f0c20f26a1a9be67a24726e070d0f53ac754003424e

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