fabiencasenave commited on
Commit
32ff3c8
1 Parent(s): 45cdafe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -23
app.py CHANGED
@@ -35,37 +35,38 @@ def sample_info(sample_id_str, fieldn):
35
  str__ = f"loading sample {sample_id_str}"
36
 
37
 
38
- # generate mesh
39
- sphere = trimesh.creation.icosphere(subdivisions=4, radius=0.8)
40
- sphere.vertices+=1e-2*np.random.randn(*sphere.vertices.shape)
41
- mesh = pyrender.Mesh.from_trimesh(sphere, smooth=False)
42
 
43
- # compose scene
44
- scene = pyrender.Scene(ambient_light=[.1, .1, .3], bg_color=[0, 0, 0])
45
- camera = pyrender.PerspectiveCamera( yfov=np.pi / 3.0)
46
- light = pyrender.DirectionalLight(color=[1,1,1], intensity=2e3)
47
 
48
- scene.add(mesh, pose= np.eye(4))
49
- scene.add(light, pose= np.eye(4))
50
 
51
- c = 2**-0.5
52
- scene.add(camera, pose=[[ 1, 0, 0, 0],
53
- [ 0, c, -c, -2],
54
- [ 0, c, c, 2],
55
- [ 0, 0, 0, 1]])
56
 
57
- # render scene
58
- r = pyrender.OffscreenRenderer(512, 512)
59
- color, _ = r.render(scene)
60
 
61
- plt.figure(figsize=(8,8))
62
- plt.imshow(color)
63
 
64
- plt.savefig("test.png")
65
 
66
 
67
 
68
- return str__, "test.png"
 
69
 
70
 
71
  if __name__ == "__main__":
@@ -76,7 +77,8 @@ if __name__ == "__main__":
76
 
77
 
78
  output1 = gr.Text(label="Training sample info")
79
- output2 = gr.Image(label="Training sample visualization")
 
80
 
81
  # d1.input(update_second, d1, d2)
82
 
 
35
  str__ = f"loading sample {sample_id_str}"
36
 
37
 
38
+ # # generate mesh
39
+ # sphere = trimesh.creation.icosphere(subdivisions=4, radius=0.8)
40
+ # sphere.vertices+=1e-2*np.random.randn(*sphere.vertices.shape)
41
+ # mesh = pyrender.Mesh.from_trimesh(sphere, smooth=False)
42
 
43
+ # # compose scene
44
+ # scene = pyrender.Scene(ambient_light=[.1, .1, .3], bg_color=[0, 0, 0])
45
+ # camera = pyrender.PerspectiveCamera( yfov=np.pi / 3.0)
46
+ # light = pyrender.DirectionalLight(color=[1,1,1], intensity=2e3)
47
 
48
+ # scene.add(mesh, pose= np.eye(4))
49
+ # scene.add(light, pose= np.eye(4))
50
 
51
+ # c = 2**-0.5
52
+ # scene.add(camera, pose=[[ 1, 0, 0, 0],
53
+ # [ 0, c, -c, -2],
54
+ # [ 0, c, c, 2],
55
+ # [ 0, 0, 0, 1]])
56
 
57
+ # # render scene
58
+ # r = pyrender.OffscreenRenderer(512, 512)
59
+ # color, _ = r.render(scene)
60
 
61
+ # plt.figure(figsize=(8,8))
62
+ # plt.imshow(color)
63
 
64
+ # plt.savefig("test.png")
65
 
66
 
67
 
68
+ # return str__, "test.png"
69
+ return str__, str__
70
 
71
 
72
  if __name__ == "__main__":
 
77
 
78
 
79
  output1 = gr.Text(label="Training sample info")
80
+ output2 = gr.Text(label="Training sample visualization")
81
+ # output2 = gr.Image(label="Training sample visualization")
82
 
83
  # d1.input(update_second, d1, d2)
84