Colin Leong commited on
Commit
4d840a0
·
1 Parent(s): 59e7fd5

update app to allow for downloading the filtered .pose

Browse files
Files changed (1) hide show
  1. app.py +52 -29
app.py CHANGED
@@ -222,40 +222,63 @@ if uploaded_file is not None:
222
  else:
223
  pass
224
 
225
- st.write(f"### Visualization")
226
- width = st.select_slider(
227
- "select width of images",
228
- list(range(1, pose.header.dimensions.width + 1)),
229
- value=pose.header.dimensions.width / 2,
230
- )
231
- step = st.select_slider(
232
- "Step value to select every nth image", list(range(1, len(frames))), value=1
233
- )
234
- fps = st.slider(
235
- "fps for visualization: ",
236
- min_value=1.0,
237
- max_value=pose.body.fps,
238
- value=pose.body.fps,
239
- )
240
- visualize_clicked = st.button(f"Visualize!")
241
 
242
- if visualize_clicked:
243
 
244
- st.write(f"Generating gif...")
 
 
245
 
246
- # st.write(pose.body.data.shape)
 
247
 
248
- st.image(get_pose_gif(pose=pose, step=step, fps=fps))
 
 
249
 
250
- with st.expander("See header"):
251
- st.write(f"### header after filtering:")
252
- st.write(pose.header)
253
 
254
- # st.write(pose.body.data.shape)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
- # st.write(visualize_pose(pose=pose)) # bunch of ndarrays
257
- # st.write([Image.fromarray(v.cv2.cvtColor(frame, cv_code)) for frame in frames])
258
 
259
- # for i, image in enumerate(images[::n]):
260
- # print(f"i={i}")
261
- # st.image(image=image, width=width)
 
222
  else:
223
  pass
224
 
225
+ filtered = st.button(f"Filter Components/Points")
226
+ if filtered:
227
+
 
 
 
 
 
 
 
 
 
 
 
 
 
228
 
 
229
 
230
+ st.write("### Filtered .pose file")
231
+ with st.expander("Show header"):
232
+ st.write(pose.header)
233
 
234
+ with st.expander(f"Show body"):
235
+ st.write(pose.body)
236
 
237
+ pose_file_out = Path(uploaded_file.name).with_suffix(".pose")
238
+ with pose_file_out.open("wb") as f:
239
+ pose.write(f)
240
 
241
+ with pose_file_out.open("rb") as f:
242
+ st.download_button("Download Filtered Pose", f, file_name=pose_file_out.name)
 
243
 
244
+ st.write(f"### Visualization")
245
+ width = st.select_slider(
246
+ "select width of images",
247
+ list(range(1, pose.header.dimensions.width + 1)),
248
+ value=pose.header.dimensions.width / 2,
249
+ )
250
+ step = st.select_slider(
251
+ "Step value to select every nth image", list(range(1, len(frames))), value=1
252
+ )
253
+ fps = st.slider(
254
+ "fps for visualization: ",
255
+ min_value=1.0,
256
+ max_value=pose.body.fps,
257
+ value=pose.body.fps,
258
+ )
259
+
260
+
261
+
262
+
263
+ visualize_clicked = st.button(f"Visualize!")
264
+
265
+
266
+ if visualize_clicked:
267
+
268
+ st.write(f"Generating gif...")
269
+
270
+ # st.write(pose.body.data.shape)
271
+
272
+ st.image(get_pose_gif(pose=pose, step=step, fps=fps))
273
+
274
+
275
+
276
+
277
+ # st.write(pose.body.data.shape)
278
 
279
+ # st.write(visualize_pose(pose=pose)) # bunch of ndarrays
280
+ # st.write([Image.fromarray(v.cv2.cvtColor(frame, cv_code)) for frame in frames])
281
 
282
+ # for i, image in enumerate(images[::n]):
283
+ # print(f"i={i}")
284
+ # st.image(image=image, width=width)