eliphatfs commited on
Commit
4c51593
·
1 Parent(s): b3bdbc8

Try two columns.

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -68,8 +68,11 @@ def render_pc(pc):
68
  )
69
  fig = go.Figure(data=[g])
70
  fig.update_layout(scene_camera=dict(up=dict(x=0, y=1, z=0)))
71
- st.plotly_chart(fig)
72
- # st.caption("Point Cloud Preview")
 
 
 
73
 
74
 
75
  try:
@@ -78,12 +81,13 @@ try:
78
  with tab_cls:
79
  if st.button("Run Classification on LVIS Categories"):
80
  pc = load_data()
81
- render_pc(pc)
82
  prog.progress(0.5, "Running Classification")
83
  pred = openshape.pred_lvis_sims(model_g14, pc)
84
- for i, (cat, sim) in zip(range(5), pred.items()):
85
- st.text(cat)
86
- st.caption("Similarity %.4f" % sim)
 
87
  prog.progress(1.0, "Idle")
88
 
89
  with tab_pc2img:
@@ -95,23 +99,25 @@ try:
95
  height = st.slider('Height', 480, 640, step=32)
96
  if st.button("Generate"):
97
  pc = load_data()
98
- render_pc(pc)
99
  prog.progress(0.49, "Running Generation")
100
  img = openshape.pc_to_image(
101
  model_l14, pc, prompt, noise_scale, width, height, cfg_scale, steps,
102
  lambda i, t, _: prog.progress(0.49 + i / (steps + 1) / 2, "Running Diffusion Step %d" % i)
103
  )
104
- st.image(img)
 
105
  prog.progress(1.0, "Idle")
106
 
107
  with tab_cap:
108
  cond_scale = st.slider('Conditioning Scale', 0.0, 4.0, 2.0)
109
  if st.button("Generate a Caption"):
110
  pc = load_data()
111
- render_pc(pc)
112
  prog.progress(0.5, "Running Generation")
113
  cap = openshape.pc_caption(model_b32, pc, cond_scale)
114
- st.text(cap)
 
115
  prog.progress(1.0, "Idle")
116
  except Exception as exc:
117
  st.error(repr(exc))
 
68
  )
69
  fig = go.Figure(data=[g])
70
  fig.update_layout(scene_camera=dict(up=dict(x=0, y=1, z=0)))
71
+ col1, col2 = st.columns(2)
72
+ with col1:
73
+ st.plotly_chart(fig, use_container_width=True)
74
+ st.caption("Point Cloud Preview")
75
+ return col2
76
 
77
 
78
  try:
 
81
  with tab_cls:
82
  if st.button("Run Classification on LVIS Categories"):
83
  pc = load_data()
84
+ col2 = render_pc(pc)
85
  prog.progress(0.5, "Running Classification")
86
  pred = openshape.pred_lvis_sims(model_g14, pc)
87
+ with col2:
88
+ for i, (cat, sim) in zip(range(5), pred.items()):
89
+ st.text(cat)
90
+ st.caption("Similarity %.4f" % sim)
91
  prog.progress(1.0, "Idle")
92
 
93
  with tab_pc2img:
 
99
  height = st.slider('Height', 480, 640, step=32)
100
  if st.button("Generate"):
101
  pc = load_data()
102
+ col2 = render_pc(pc)
103
  prog.progress(0.49, "Running Generation")
104
  img = openshape.pc_to_image(
105
  model_l14, pc, prompt, noise_scale, width, height, cfg_scale, steps,
106
  lambda i, t, _: prog.progress(0.49 + i / (steps + 1) / 2, "Running Diffusion Step %d" % i)
107
  )
108
+ with col2:
109
+ st.image(img)
110
  prog.progress(1.0, "Idle")
111
 
112
  with tab_cap:
113
  cond_scale = st.slider('Conditioning Scale', 0.0, 4.0, 2.0)
114
  if st.button("Generate a Caption"):
115
  pc = load_data()
116
+ col2 = render_pc(pc)
117
  prog.progress(0.5, "Running Generation")
118
  cap = openshape.pc_caption(model_b32, pc, cond_scale)
119
+ with col2:
120
+ st.text(cap)
121
  prog.progress(1.0, "Idle")
122
  except Exception as exc:
123
  st.error(repr(exc))