dylanplummer commited on
Commit
e3ec7f6
·
1 Parent(s): 319f52e

add more examples

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -37,6 +37,7 @@ compiled_model_ir = ie.compile_model(model=model_ir, device_name="CPU", config=c
37
 
38
  a = os.path.join(os.path.dirname(__file__), "files", "dylan.mp4")
39
  b = os.path.join(os.path.dirname(__file__), "files", "train14.mp4")
 
40
 
41
 
42
  class SquarePad:
@@ -218,12 +219,12 @@ def inference(x, count_only_api, api_key, img_size=192, seq_len=64, stride_lengt
218
 
219
  if api_call:
220
  if count_only_api:
221
- return f"{count_pred:.2f}"
222
  else:
223
  return np.array2string(periodLength, formatter={'float_kind':lambda x: "%.2f" % x}).replace('\n', ''), \
224
  np.array2string(periodicity, formatter={'float_kind':lambda x: "%.2f" % x}).replace('\n', ''), \
225
  np.array2string(full_marks, formatter={'float_kind':lambda x: "%.2f" % x}).replace('\n', ''), \
226
- f"reps: {count_pred:.2f}, marks: {marks_count_pred:.1f}", \
227
  f"single_rope_speed: {event_type_probs[0]:.3f}, double_dutch: {event_type_probs[1]:.3f}, double_unders: {event_type_probs[2]:.3f}, single_bounce: {event_type_probs[3]:.3f}"
228
 
229
 
@@ -348,8 +349,9 @@ with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
348
  demo_inference = partial(inference, count_only_api=False, api_key=None)
349
 
350
  gr.Examples(examples=[
351
- [a, True, False, -1, True, 1.0, 0.95],
352
- [b, False, True, -1, True, 1.0, 0.95],
 
353
  ],
354
  inputs=[in_video],
355
  outputs=[out_text, out_plot, out_hist, out_event_type_dist],
 
37
 
38
  a = os.path.join(os.path.dirname(__file__), "files", "dylan.mp4")
39
  b = os.path.join(os.path.dirname(__file__), "files", "train14.mp4")
40
+ c = os.path.join(os.path.dirname(__file__), "files", "train_17.mp4")
41
 
42
 
43
  class SquarePad:
 
219
 
220
  if api_call:
221
  if count_only_api:
222
+ return f"{count_pred:.2f} (conf: {total_confidence:.2f})"
223
  else:
224
  return np.array2string(periodLength, formatter={'float_kind':lambda x: "%.2f" % x}).replace('\n', ''), \
225
  np.array2string(periodicity, formatter={'float_kind':lambda x: "%.2f" % x}).replace('\n', ''), \
226
  np.array2string(full_marks, formatter={'float_kind':lambda x: "%.2f" % x}).replace('\n', ''), \
227
+ f"reps: {count_pred:.2f}, marks: {marks_count_pred:.1f}, confidence: {total_confidence:.2f}", \
228
  f"single_rope_speed: {event_type_probs[0]:.3f}, double_dutch: {event_type_probs[1]:.3f}, double_unders: {event_type_probs[2]:.3f}, single_bounce: {event_type_probs[3]:.3f}"
229
 
230
 
 
349
  demo_inference = partial(inference, count_only_api=False, api_key=None)
350
 
351
  gr.Examples(examples=[
352
+ [a],
353
+ [b],
354
+ [c]
355
  ],
356
  inputs=[in_video],
357
  outputs=[out_text, out_plot, out_hist, out_event_type_dist],