dylan-plummer commited on
Commit
96b6525
·
1 Parent(s): 2d80660

found a jumper

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -51,7 +51,7 @@ def sigmoid(x):
51
  return 1 / (1 + np.exp(-x))
52
 
53
 
54
- @spaces.GPU()
55
  def inference(stream_url, start_time, end_time, count_only_api, api_key,
56
  img_size=288, seq_len=64, stride_length=32, stride_pad=3, batch_size=4,
57
  miss_threshold=0.8, marks_threshold=0.5, median_pred_filter=True, center_crop=True, both_feet=True,
@@ -229,7 +229,10 @@ def inference(stream_url, start_time, end_time, count_only_api, api_key,
229
  except ZeroDivisionError:
230
  confidence = 0
231
  self_err = abs(count_pred - marks_count_pred)
232
- self_pct_err = self_err / count_pred
 
 
 
233
  total_confidence = confidence * (1 - self_pct_err)
234
 
235
  if both_feet:
@@ -395,7 +398,7 @@ with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
395
  # ]
396
 
397
  gr.Examples(examples=[
398
- ['https://hiemdall-dev2.azurewebsites.net/api/playlist/rec_DA6NyTCw/vod', '0', '30'],
399
  #[os.path.join(os.path.dirname(__file__), "files", "train14.mp4")],
400
  #[os.path.join(os.path.dirname(__file__), "files", "train_17.mp4")],
401
  #[os.path.join(os.path.dirname(__file__), "files", "train13.mp4")],
 
51
  return 1 / (1 + np.exp(-x))
52
 
53
 
54
+ @spaces.GPU(duration=120)
55
  def inference(stream_url, start_time, end_time, count_only_api, api_key,
56
  img_size=288, seq_len=64, stride_length=32, stride_pad=3, batch_size=4,
57
  miss_threshold=0.8, marks_threshold=0.5, median_pred_filter=True, center_crop=True, both_feet=True,
 
229
  except ZeroDivisionError:
230
  confidence = 0
231
  self_err = abs(count_pred - marks_count_pred)
232
+ try:
233
+ self_pct_err = self_err / count_pred
234
+ except ZeroDivisionError:
235
+ self_pct_err = 0
236
  total_confidence = confidence * (1 - self_pct_err)
237
 
238
  if both_feet:
 
398
  # ]
399
 
400
  gr.Examples(examples=[
401
+ ['https://hiemdall-dev2.azurewebsites.net/api/playlist/rec_rd2FAyUo/vod', '2600', '2630'],
402
  #[os.path.join(os.path.dirname(__file__), "files", "train14.mp4")],
403
  #[os.path.join(os.path.dirname(__file__), "files", "train_17.mp4")],
404
  #[os.path.join(os.path.dirname(__file__), "files", "train13.mp4")],