Gradio PyVista Viewer
Project description
trame-gradio-component
A Gradio custom component that embeds an interactive PyVista plotter in any Gradio app.
Installation
Clone the repository, then install the package:
pip install gradio_pyvistaplotter/
Quick Start
The following minimal example renders an interactive 3D sphere:
import pyvista as pv
import gradio as gr
from gradio_pyvistaplotter import PyvistaPlotter
plotter = pv.Plotter()
plotter.add_mesh(pv.Sphere(), show_edges=True, color="gold")
with gr.Blocks() as demo:
gr.Markdown("Gradio app with a PyVista plotter")
viewer = PyvistaPlotter(value=plotter)
demo.launch()
A more complete example with a mesh loader is available in gradio_pyvistaplotter/demo/app.py.
Known Issues
Linux – Ctrl+C does not stop the application
When using PyvistaPlotter with the standard gr.Blocks.launch() method, the application cannot be interrupted from the terminal via Ctrl+C. As a workaround, this package provides a custom launch() function that wraps gr.Blocks.launch() with proper signal handling:
import pyvista as pv
import gradio as gr
from gradio_pyvistaplotter import PyvistaPlotter, launch
plotter = pv.Plotter()
plotter.add_mesh(pv.Sphere(), show_edges=True, color="gold")
with gr.Blocks() as demo:
gr.Markdown("Gradio app with a PyVista plotter")
viewer = PyvistaPlotter(value=plotter)
launch(demo) # custom launch with proper signal handling
Issues / TODO
- Currently, two files are written to the tmp directory on each render:
static_viewer.htmlandscene_<id>.vtksz. Investigate whether the HTML can be generated and passed as an in-memory string instead of a file on disk. -
static_viewer.htmlis currently bundled with this package — should it be imported directly fromtrameinstead?
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
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
File details
Details for the file gradio_pyvistaplotter-0.1.0.tar.gz.
File metadata
- Download URL: gradio_pyvistaplotter-0.1.0.tar.gz
- Upload date:
- Size: 322.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9afcda2330ce2125ecf28fc3dad9fac4463563c09aa67bf94ef5818f75eda30f
|
|
| MD5 |
0623f0ec60c87d2b025934e55dcd9bc7
|
|
| BLAKE2b-256 |
4be7c05988bdc27ebf5e7c432c465a4f9d22ddf91bc621fc26cce5d649d3bb99
|
Provenance
The following attestation bundles were made for gradio_pyvistaplotter-0.1.0.tar.gz:
Publisher:
publish.yml on Louis-Pujol/gradio-pyvistaplotter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gradio_pyvistaplotter-0.1.0.tar.gz -
Subject digest:
9afcda2330ce2125ecf28fc3dad9fac4463563c09aa67bf94ef5818f75eda30f - Sigstore transparency entry: 1079338625
- Sigstore integration time:
-
Permalink:
Louis-Pujol/gradio-pyvistaplotter@f4485d49408d850dfe35a55a6c6a8dc62add7bab -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Louis-Pujol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4485d49408d850dfe35a55a6c6a8dc62add7bab -
Trigger Event:
push
-
Statement type:
File details
Details for the file gradio_pyvistaplotter-0.1.0-py3-none-any.whl.
File metadata
- Download URL: gradio_pyvistaplotter-0.1.0-py3-none-any.whl
- Upload date:
- Size: 264.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb9ba8c31e286f8bf40d4248a8cf842c3ddc50b447eb014dd5d76c4018e21ad4
|
|
| MD5 |
5c47351f5c19c0e77e3a70d8fa201806
|
|
| BLAKE2b-256 |
e46418b493a867749a1b01113b6913e83476c1fadd1622a72b8b1f1c8c5ec306
|
Provenance
The following attestation bundles were made for gradio_pyvistaplotter-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Louis-Pujol/gradio-pyvistaplotter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gradio_pyvistaplotter-0.1.0-py3-none-any.whl -
Subject digest:
fb9ba8c31e286f8bf40d4248a8cf842c3ddc50b447eb014dd5d76c4018e21ad4 - Sigstore transparency entry: 1079338633
- Sigstore integration time:
-
Permalink:
Louis-Pujol/gradio-pyvistaplotter@f4485d49408d850dfe35a55a6c6a8dc62add7bab -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Louis-Pujol
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f4485d49408d850dfe35a55a6c6a8dc62add7bab -
Trigger Event:
push
-
Statement type: