EndeavoringYoon commited on
Commit
cc047d7
·
verified ·
1 Parent(s): 15d8301

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +7 -7
src/streamlit_app.py CHANGED
@@ -16,15 +16,15 @@ In the meantime, below is an example of what you can do with just a few lines of
16
  def init_robot_system():
17
  ae, config = load_saved_model(device="cpu")
18
  robot_chars = RobotCharacteristics()
19
- label_data = np.load('./data/label.npy')
20
- njnt_data = np.load('.data/njnt.npy')
21
- indices_data = np.load('.data/indices.npy')
22
  robot_chars.max_joints_per_group=njnt_data
23
  return ae, robot_chars
24
  motion_level = 'easy'
25
  x_1 = np.load(f'./src/{motion_level}_X1.npy')
26
- x_2 = np.load(f'./{motion_level}_X2.npy')
27
- z_1 = np.load(f'./{motion_level}_Z1.npy')
28
 
29
 
30
 
@@ -32,11 +32,11 @@ st.title("LEGO Latent Space Explorer")
32
  z1 = st.slider("X", -10.0, 10.0)
33
  z2 = st.slider("Y", -10.0, 10.0)
34
 
35
- if st.button("Generate Design"):
36
  ae, robot_chars = init_robot_system()
37
  decode = ae.decode(th.tensor(easy_optimal,device=next(ae.parameters()).device,dtype=th.float32)).detach().numpy()
38
  full_decode=robot_chars.build_full_interp_from_symmetric(interp_data_sym=decode,threshold=0.5)
39
  data_to_visualize = robot_chars.convert_flat_interp_to_dict(full_decode)
40
  clip = robot_chars.visualize_data_to_classify(data_to_visualize, save_video=True,vis=True, test = True, xml=True)
41
- st.success("디자인 생성 완료!")
42
  st.image("result.png") # 생성된 이미지 보여주기
 
16
  def init_robot_system():
17
  ae, config = load_saved_model(device="cpu")
18
  robot_chars = RobotCharacteristics()
19
+ # label_data = np.load('./src/label.npy')
20
+ njnt_data = np.load('./src/njnt.npy')
21
+ # indices_data = np.load('./src/indices.npy')
22
  robot_chars.max_joints_per_group=njnt_data
23
  return ae, robot_chars
24
  motion_level = 'easy'
25
  x_1 = np.load(f'./src/{motion_level}_X1.npy')
26
+ x_2 = np.load(f'./src/{motion_level}_X2.npy')
27
+ z_1 = np.load(f'./src/{motion_level}_Z1.npy')
28
 
29
 
30
 
 
32
  z1 = st.slider("X", -10.0, 10.0)
33
  z2 = st.slider("Y", -10.0, 10.0)
34
 
35
+ if st.button("Explore Latent Space"):
36
  ae, robot_chars = init_robot_system()
37
  decode = ae.decode(th.tensor(easy_optimal,device=next(ae.parameters()).device,dtype=th.float32)).detach().numpy()
38
  full_decode=robot_chars.build_full_interp_from_symmetric(interp_data_sym=decode,threshold=0.5)
39
  data_to_visualize = robot_chars.convert_flat_interp_to_dict(full_decode)
40
  clip = robot_chars.visualize_data_to_classify(data_to_visualize, save_video=True,vis=True, test = True, xml=True)
41
+ st.success("Kinematic Structure Decoded!")
42
  st.image("result.png") # 생성된 이미지 보여주기