Commit ·
b2bf29b
1
Parent(s): d192993
fix demo inference
Browse files
app.py
CHANGED
|
@@ -165,6 +165,7 @@ def inference(x, count_only_api, api_key, img_size=192, seq_len=64, stride_lengt
|
|
| 165 |
all_frames.append(all_frames[-1])
|
| 166 |
batch_list = []
|
| 167 |
idx_list = []
|
|
|
|
| 168 |
for i in tqdm(range(0, length + stride_length - stride_pad, stride_length)):
|
| 169 |
batch = all_frames[i:i + seq_len]
|
| 170 |
Xlist = []
|
|
@@ -355,14 +356,16 @@ with gr.Blocks() as demo:
|
|
| 355 |
faq += "\n* **Q:** Does the model count both feet?\n * **A:** Yes, but for convention we usually return the halved (one foot) score."
|
| 356 |
gr.Markdown(faq)
|
| 357 |
|
|
|
|
|
|
|
| 358 |
gr.Examples(examples=[
|
| 359 |
[a, True, False, -1, True, 1.0, 0.95],
|
| 360 |
[b, False, True, -1, True, 1.0, 0.95],
|
| 361 |
],
|
| 362 |
inputs=[in_video],
|
| 363 |
outputs=[out_text, out_plot, out_hist],
|
| 364 |
-
fn=
|
| 365 |
-
|
| 366 |
run_button.click(demo_inference, [in_video], outputs=[out_text, out_plot, out_hist])
|
| 367 |
api_inference = partial(inference, api_call=True)
|
| 368 |
api_dummy_button.click(api_inference, [in_video, count_only, api_token], outputs=[period_length], api_name='inference')
|
|
|
|
| 165 |
all_frames.append(all_frames[-1])
|
| 166 |
batch_list = []
|
| 167 |
idx_list = []
|
| 168 |
+
print(length, stride_length, stride_pad)
|
| 169 |
for i in tqdm(range(0, length + stride_length - stride_pad, stride_length)):
|
| 170 |
batch = all_frames[i:i + seq_len]
|
| 171 |
Xlist = []
|
|
|
|
| 356 |
faq += "\n* **Q:** Does the model count both feet?\n * **A:** Yes, but for convention we usually return the halved (one foot) score."
|
| 357 |
gr.Markdown(faq)
|
| 358 |
|
| 359 |
+
demo_inference = partial(inference, count_only_api=False, api_key=None)
|
| 360 |
+
|
| 361 |
gr.Examples(examples=[
|
| 362 |
[a, True, False, -1, True, 1.0, 0.95],
|
| 363 |
[b, False, True, -1, True, 1.0, 0.95],
|
| 364 |
],
|
| 365 |
inputs=[in_video],
|
| 366 |
outputs=[out_text, out_plot, out_hist],
|
| 367 |
+
fn=demo_inference, cache_examples=os.getenv('SYSTEM') == 'spaces')
|
| 368 |
+
|
| 369 |
run_button.click(demo_inference, [in_video], outputs=[out_text, out_plot, out_hist])
|
| 370 |
api_inference = partial(inference, api_call=True)
|
| 371 |
api_dummy_button.click(api_inference, [in_video, count_only, api_token], outputs=[period_length], api_name='inference')
|