A Streamlit component to display STL files.
This component requires access to write files to the temporary directory.
pip install streamlit_stl
Look at the example for a streamlit Web App:
The original STL file is from Printables.
import streamlit as st
from streamlit_stl import stl_from_file
success = stl_from_file(file_path=path_to_conf, # path to the stl file
color='#FF9900', # color of the stl file
material='material', # material of the stl file, either 'material' or 'wireframe'
auto_rotate=True, # auto rotate the stl file
height='500', # height of the viewer frame
key=None) # streamlit component key
import streamlit as st
from streamlit_stl import stl_from_text
file_input = st.file_uploader("Or upload a STL file ", type=["stl"])
success = stl_from_text(text=file_input.getvalue(), # text of te stl file
color='#FF9900', # color of the stl file
material='material', # material of the stl file, either 'material' or 'wireframe'
auto_rotate=True, # auto rotate the stl file
height='500', # height of the viewer frame
key=None) # streamlit component key
The functions return a boolean value indicating if the program was able to write and read the files.
Code is licensed under the GNU General Public License v3.0 (GPL-3.0)