pgleeson commited on
Commit
1fa56f6
Β·
1 Parent(s): 40404b6

Update app

Browse files
Files changed (4) hide show
  1. README.md +5 -5
  2. app.py +47 -3
  3. packages.txt +4 -0
  4. requirements.txt +1 -0
README.md CHANGED
@@ -1,13 +1,13 @@
1
  ---
2
  title: TestOSBB
3
- emoji: 🐨
4
- colorFrom: pink
5
- colorTo: green
6
  sdk: streamlit
7
  sdk_version: 1.42.1
8
  app_file: app.py
9
  pinned: false
10
- short_description: Test OSBB
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: TestOSBB
3
+ emoji: πŸπŸ§ πŸ€–
4
+ colorFrom: green
5
+ colorTo: pink
6
  sdk: streamlit
7
  sdk_version: 1.42.1
8
  app_file: app.py
9
  pinned: false
10
+ short_description: test
11
  ---
12
 
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -1,4 +1,48 @@
1
- import streamlit as st
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- x = st.slider('Select a value')
4
- st.write(x, 'squared is', x * x)
 
1
+ import pyvista as pv
2
+ import sys
3
+
4
+ st_mode = '-gui' not in sys.argv
5
+
6
+ if st_mode:
7
+
8
+ import streamlit as st
9
+ st.set_page_config(layout="wide")
10
+ from stpyvista import stpyvista
11
+
12
+ from stpyvista.utils import start_xvfb
13
+
14
+ if "IS_XVFB_RUNNING" not in st.session_state:
15
+ start_xvfb()
16
+ st.session_state.IS_XVFB_RUNNING = True
17
+
18
+
19
+ ## Initialize a plotter object
20
+ plotter = pv.Plotter(window_size=[800,600])
21
+
22
+
23
+ print('Reading objs...')
24
+ mesh = pv.read('a_mouse.obj')
25
+ plotter.add_mesh(mesh, smooth_shading=True, color='white')
26
+
27
+ mesh2 = pv.read('full_mouse.obj')
28
+ mesh2.translate((-40,0,0), inplace=True)
29
+ plotter.add_mesh(mesh2, smooth_shading=True, color='tan')
30
+
31
+
32
+ print('Read objs...')
33
+
34
+ plotter.add_axes()
35
+ plotter.enable_mesh_picking(show_message=True)
36
+
37
+
38
+ ## Final touches
39
+ plotter.view_isometric()
40
+ #plotter.add_scalar_bar()
41
+ plotter.background_color = 'white'
42
+
43
+ if st_mode:
44
+ ## Pass a key to avoid re-rendering at each page change
45
+ stpyvista(plotter, key="pv_cube")
46
+ else:
47
+ plotter.show()
48
 
 
 
packages.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ procps
2
+ libgl1-mesa-glx
3
+ xvfb
4
+
requirements.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ stpyvista