dylanplummer commited on
Commit
ef86f0f
·
1 Parent(s): a852991

add max video length

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -51,7 +51,7 @@ def sigmoid(x):
51
  return 1 / (1 + np.exp(-x))
52
 
53
 
54
- @spaces.GPU(duration=180)
55
  def inference(x, count_only_api, api_key, img_size=224, seq_len=64, stride_length=32, stride_pad=3, batch_size=4, miss_threshold=0.8, marks_threshold=0.6, median_pred_filter=True, center_crop=True, both_feet=True, api_call=False):
56
  print(x)
57
  # check if GPU is available
@@ -60,6 +60,7 @@ def inference(x, count_only_api, api_key, img_size=224, seq_len=64, stride_lengt
60
  "user_compute_stream": str(torch.cuda.current_stream().cuda_stream)})]
61
  sess_options = ort.SessionOptions()
62
  ort_sess = ort.InferenceSession(onnx_file, sess_options=sess_options, providers=providers)
 
63
  else:
64
  ort_sess = ort.InferenceSession(onnx_file)
65
  #api = HfApi(token=os.environ['DATASET_SECRET'])
@@ -315,7 +316,9 @@ DESCRIPTION += '\nDemo created by [Dylan Plummer](https://dylan-plummer.github.i
315
 
316
  with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
317
  gr.Markdown(DESCRIPTION)
318
- in_video = gr.PlayableVideo(label="Input Video", elem_id='input-video', format='mp4', width=400, height=400, interactive=True, container=True)
 
 
319
 
320
  with gr.Row():
321
  run_button = gr.Button(value="Run", elem_id='run-button', scale=1)
 
51
  return 1 / (1 + np.exp(-x))
52
 
53
 
54
+ @spaces.GPU()
55
  def inference(x, count_only_api, api_key, img_size=224, seq_len=64, stride_length=32, stride_pad=3, batch_size=4, miss_threshold=0.8, marks_threshold=0.6, median_pred_filter=True, center_crop=True, both_feet=True, api_call=False):
56
  print(x)
57
  # check if GPU is available
 
60
  "user_compute_stream": str(torch.cuda.current_stream().cuda_stream)})]
61
  sess_options = ort.SessionOptions()
62
  ort_sess = ort.InferenceSession(onnx_file, sess_options=sess_options, providers=providers)
63
+ print("Using GPU")
64
  else:
65
  ort_sess = ort.InferenceSession(onnx_file)
66
  #api = HfApi(token=os.environ['DATASET_SECRET'])
 
316
 
317
  with gr.Blocks(theme='WeixuanYuan/Soft_dark') as demo:
318
  gr.Markdown(DESCRIPTION)
319
+ in_video = gr.PlayableVideo(label="Input Video", elem_id='input-video', format='mp4',
320
+ width=400, height=400, interactive=True, container=True,
321
+ max_length=150)
322
 
323
  with gr.Row():
324
  run_button = gr.Button(value="Run", elem_id='run-button', scale=1)