Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import streamlit.components.v1 as components
|
| 3 |
+
import pyvista
|
| 4 |
+
from pyvista import examples
|
| 5 |
+
pyvista.start_xvfb()
|
| 6 |
+
mesh = examples.load_uniform()
|
| 7 |
+
pl = pyvista.Plotter(shape=(1,2))
|
| 8 |
+
_ = pl.add_mesh(mesh, scalars='Spatial Point Data', show_edges=True)
|
| 9 |
+
pl.subplot(0,1)
|
| 10 |
+
_ = pl.add_mesh(mesh, scalars='Spatial Cell Data', show_edges=True)
|
| 11 |
+
pl.export_html('pyvista.html') # doctest:+SKIP
|
| 12 |
+
|
| 13 |
+
option=st.sidebar.radio('Pyvista',('On','Off'))
|
| 14 |
+
if option=='On':
|
| 15 |
+
HtmlFile = open("pyvista.html", 'r', encoding='utf-8')
|
| 16 |
+
source_code = HtmlFile.read()
|
| 17 |
+
components.html(source_code, height = 500,width=500)
|