Skip to main content

Visualise files

Project description


tags: [gradio-custom-component, File] title: gradio_viewer short_description: Visualise files colorFrom: blue colorTo: yellow sdk: gradio pinned: false app_file: space.py

gradio_viewer

PyPI - Version

Visualise files

Installation

pip install gradio_viewer

Usage

import gradio as gr
from gradio_viewer import Viewer

import sys

sys.path = list(dict.fromkeys(sys.path))
print(sys.path)
print(sys.prefix)

with gr.Blocks() as demo:
    with gr.Row():
        pdf = (
            Viewer(
                value=[
                    "../../.neo-sandbox/dummy-email/6dbf7d358da06263/Le_Petit_Chaperon_Rouge_Modifie.pdf",
                    "../../.neo-sandbox/dummy-email/6dbf7d358da06263/Polytechnique_IA_generative.pdf",
                    "../../.neo-sandbox/dummy-email/6dbf7d358da06263/comparaison_couts.png",
                ],
                elem_classes=["visualisation"],
                n=1,
                # value="../../.neo-sandbox/dummy-email/6dbf7d358da06263/mermaid_graph-2.html",
                # value="../../.neo-sandbox/dummy-email/6dbf7d358da06263/demonstration_pythagore.md",
                # value="../../.neo-sandbox/dummy-email/6dbf7d358da06263/calcul_pythagore.py",
            ),
        )  # interactive version of your component

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

Viewer

Initialization

name type default description
value
Any
None None
height
int | None
None None
label
str | None
None None
info
str | None
None None
show_label
bool | None
None None
container
bool
True None
scale
int | None
None None
min_width
int | None
None None
interactive
bool | None
None None
visible
bool
True None
elem_id
str | None
None None
elem_classes
list[str] | str | None
None None
render
bool
True None
load_fn
Callable[..., Any] | None
None None
every
Timer | float | None
None None
n
int
0 None

Events

name description
change
upload

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, the data after preprocessing, sent to the user's function in the backend.
  • As input: Should return, expects a str filepath or URL, or a list[str] of filepaths/URLs.
def predict(
    value: str
) -> str | list[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_viewer-0.0.4.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

gradio_viewer-0.0.4-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file gradio_viewer-0.0.4.tar.gz.

File metadata

  • Download URL: gradio_viewer-0.0.4.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.18

File hashes

Hashes for gradio_viewer-0.0.4.tar.gz
Algorithm Hash digest
SHA256 33df160384f7e087d52bdb9773eb2604bbf60cbcec1be1c26906f80b612bee15
MD5 5370ec590cd6430ef45d7246797052cd
BLAKE2b-256 df3982e1d1c90b4c3fcc9154e9b75b36b7c84c3906d382d6487816df7a451ea0

See more details on using hashes here.

File details

Details for the file gradio_viewer-0.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for gradio_viewer-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 95ad718710cdf16f15e63fcf3458991be90dd956fd7a72981b22e9c701641d0c
MD5 69002c9a3ec454733bd78abc4f8f033a
BLAKE2b-256 30251164b5553a135b2bc0f4f7398b6b6bc381db10a270c221a5ab9fd440582c

See more details on using hashes here.

Supported by

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