Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	
		lmoss
		
	commited on
		
		
					Commit 
							
							·
						
						91fb569
	
1
								Parent(s):
							
							efaebf1
								
added dual pane view
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -7,6 +7,8 @@ import time 
     | 
|
| 7 | 
         
             
            import numpy as np
         
     | 
| 8 | 
         
             
            import streamlit.components.v1 as components
         
     | 
| 9 | 
         | 
| 
         | 
|
| 
         | 
|
| 10 | 
         
             
            url = "https://github.com/LukasMosser/PorousMediaGan/blob/master/checkpoints/berea/berea_generator_epoch_24.pth?raw=true"
         
     | 
| 11 | 
         | 
| 12 | 
         
             
            # If repo is private - we need to add a token in header:
         
     | 
| 
         @@ -19,7 +21,7 @@ with open('berea_generator_epoch_24.pth', 'wb') as f: 
     | 
|
| 19 | 
         
             
            st.text(resp.status_code)
         
     | 
| 20 | 
         | 
| 21 | 
         
             
            pv.set_plot_theme("document")
         
     | 
| 22 | 
         
            -
            pl = pv.Plotter(shape=( 
     | 
| 23 | 
         
             
                                 window_size=(800, 800))
         
     | 
| 24 | 
         | 
| 25 | 
         
             
            netG = DCGAN3D_G(64, 512, 1, 32, 1)
         
     | 
| 
         @@ -49,7 +51,10 @@ grid.point_data['my_array'] = values 
     | 
|
| 49 | 
         
             
            slices = grid.slice_orthogonal()
         
     | 
| 50 | 
         
             
            mesh = grid.contour(1, values, method='marching_cubes', rng=[1, 0], preference="points")
         
     | 
| 51 | 
         
             
            dist = np.linalg.norm(mesh.points, axis=1)
         
     | 
| 52 | 
         
            -
             
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 53 | 
         
             
            pl.add_mesh(mesh, scalars=dist)
         
     | 
| 54 | 
         
             
            pl.export_html('pyvista.html')
         
     | 
| 55 | 
         | 
| 
         | 
|
| 7 | 
         
             
            import numpy as np
         
     | 
| 8 | 
         
             
            import streamlit.components.v1 as components
         
     | 
| 9 | 
         | 
| 10 | 
         
            +
            st.title("Generating Porous Media with GANs")
         
     | 
| 11 | 
         
            +
             
     | 
| 12 | 
         
             
            url = "https://github.com/LukasMosser/PorousMediaGan/blob/master/checkpoints/berea/berea_generator_epoch_24.pth?raw=true"
         
     | 
| 13 | 
         | 
| 14 | 
         
             
            # If repo is private - we need to add a token in header:
         
     | 
| 
         | 
|
| 21 | 
         
             
            st.text(resp.status_code)
         
     | 
| 22 | 
         | 
| 23 | 
         
             
            pv.set_plot_theme("document")
         
     | 
| 24 | 
         
            +
            pl = pv.Plotter(shape=(2, 1),
         
     | 
| 25 | 
         
             
                                 window_size=(800, 800))
         
     | 
| 26 | 
         | 
| 27 | 
         
             
            netG = DCGAN3D_G(64, 512, 1, 32, 1)
         
     | 
| 
         | 
|
| 51 | 
         
             
            slices = grid.slice_orthogonal()
         
     | 
| 52 | 
         
             
            mesh = grid.contour(1, values, method='marching_cubes', rng=[1, 0], preference="points")
         
     | 
| 53 | 
         
             
            dist = np.linalg.norm(mesh.points, axis=1)
         
     | 
| 54 | 
         
            +
             
     | 
| 55 | 
         
            +
            pl.add_mesh(slices, cmap="gray")
         
     | 
| 56 | 
         
            +
            pl.subplot(1, 0)
         
     | 
| 57 | 
         
            +
             
     | 
| 58 | 
         
             
            pl.add_mesh(mesh, scalars=dist)
         
     | 
| 59 | 
         
             
            pl.export_html('pyvista.html')
         
     | 
| 60 | 
         |