
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
gradio_viewer
Visualise any type of files
pip install gradio_viewer
import gradio as gr
from gradio_viewer import Viewer
def set_interface():
view_with_ms = Viewer(
value=[
"./demo/data/Le_Petit_Chaperon_Rouge_Modifie.docx",
"./demo/data/mermaid_graph-2.html",
"./demo/data/graphique_couts_annuels.png",
"./demo/data/Le_Petit_Chaperon_Rouge.zouzou",
"./demo/data/viewer.py",
],
elem_classes=["visualisation"],
n=0,
height=300,
visible=True,
ms_files=True,
)
view_without_ms = Viewer(
value=[
"./demo/data/Le_Petit_Chaperon_Rouge_Modifie.docx",
"./demo/data/mermaid_graph-2.html",
"./demo/data/graphique_couts_annuels.png",
"./demo/data/Le_Petit_Chaperon_Rouge.zouzou",
],
elem_classes=["visualisation"],
n=1,
height=300,
visible=True,
ms_files=False,
)
empty_view1 = view_with_ms
empty_view2 = view_without_ms
return view_with_ms, view_without_ms, empty_view1, empty_view2
with gr.Blocks() as demo:
with gr.Row():
view_with_ms = Viewer(visible=False)
view_without_ms = Viewer(visible=False)
empty_view1 = Viewer(visible=False)
empty_view2 = Viewer(visible=False)
demo.load(
set_interface, outputs=[view_with_ms, view_without_ms, empty_view1, empty_view2]
).then(
fn=lambda: (
Viewer(visible=False, value=None, elem_id="empty1"),
Viewer(visible=False, value=[], elem_id="empty2"),
),
outputs=[empty_view1, empty_view2],
)
if __name__ == "__main__":
demo.launch()
Viewer
name | type | default | description |
---|---|---|---|
value |
| None | None |
height |
| None | None |
label |
| None | None |
info |
| None | None |
show_label |
| None | None |
container |
| True | None |
scale |
| None | None |
min_width |
| None | None |
interactive |
| None | None |
visible |
| True | None |
elem_id |
| None | None |
elem_classes |
| None | None |
render |
| True | None |
load_fn |
| None | None |
every |
| None | None |
n |
| 0 | None |
max_size |
| 5000000 | None |
max_pages |
| 100 | None |
ms_files |
| True | None |
libre_office |
| True | None |
name | description |
---|---|
change | |
upload |
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).
The code snippet below is accurate in cases where the component is used as both an input and an output.
str
filepath or URL, or a list[str]
of filepaths/URLs.def predict(
value: str
) -> str | list[str] | None:
return value
FAQs
Visualise any type of files
We found that gradio-viewer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.