Spaces:
Sleeping
Sleeping
dillonlaird
commited on
Commit
•
3882e18
1
Parent(s):
841f4d5
fixed case with no surfers
Browse files
app.py
CHANGED
@@ -15,10 +15,11 @@ FPS = 2
|
|
15 |
PLAYLIST_URL = (
|
16 |
"https://live.hdontap.com/hls/hosb1/topanga_swellmagnet.stream/playlist.m3u8"
|
17 |
)
|
18 |
-
API_KEY = os.environ["API_KEY"]
|
19 |
-
ENDPOINT_ID = os.environ["ENDPOINT_ID"]
|
20 |
|
21 |
|
|
|
22 |
render_svg(Path("./assets/landing-logo.svg").read_text())
|
23 |
st.title("Topanga Beach Surfer Counter")
|
24 |
st.write(
|
@@ -39,7 +40,11 @@ def get_latest_surfer_count():
|
|
39 |
break
|
40 |
frs.extend(frame.run_predict(predictor=surfer_model).overlay_predictions())
|
41 |
frs.save_video(str(VIDEO_CACHE_PATH), video_fps=FPS, image_src="overlay")
|
42 |
-
|
|
|
|
|
|
|
|
|
43 |
st.video(open(VIDEO_CACHE_PATH, "rb").read())
|
44 |
st.write(f"Surfer count: **{surfers}**")
|
45 |
|
|
|
15 |
PLAYLIST_URL = (
|
16 |
"https://live.hdontap.com/hls/hosb1/topanga_swellmagnet.stream/playlist.m3u8"
|
17 |
)
|
18 |
+
# API_KEY = os.environ["API_KEY"]
|
19 |
+
# ENDPOINT_ID = os.environ["ENDPOINT_ID"]
|
20 |
|
21 |
|
22 |
+
print(st.theme())
|
23 |
render_svg(Path("./assets/landing-logo.svg").read_text())
|
24 |
st.title("Topanga Beach Surfer Counter")
|
25 |
st.write(
|
|
|
40 |
break
|
41 |
frs.extend(frame.run_predict(predictor=surfer_model).overlay_predictions())
|
42 |
frs.save_video(str(VIDEO_CACHE_PATH), video_fps=FPS, image_src="overlay")
|
43 |
+
counts = frs.get_class_counts()
|
44 |
+
if "surfer" in counts:
|
45 |
+
surfers = frs.get_class_counts()["surfer"] / (VIDEO_LEN_SEC * FPS)
|
46 |
+
else:
|
47 |
+
surfers = 0
|
48 |
st.video(open(VIDEO_CACHE_PATH, "rb").read())
|
49 |
st.write(f"Surfer count: **{surfers}**")
|
50 |
|