Spaces:
Paused
Paused
bug2
Browse files- app/streamlit_app.py +24 -18
app/streamlit_app.py
CHANGED
|
@@ -791,27 +791,33 @@ def main():
|
|
| 791 |
|
| 792 |
# Show action buttons and their results (only if analysis is complete)
|
| 793 |
if st.session_state.video_analyzed:
|
| 794 |
-
# Best-effort Trackio logging once per analyzed video
|
| 795 |
if not st.session_state.get("_trackio_logged_once"):
|
| 796 |
try:
|
| 797 |
-
import
|
| 798 |
-
|
| 799 |
-
|
| 800 |
-
|
| 801 |
-
|
| 802 |
-
|
| 803 |
-
|
| 804 |
-
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
|
| 808 |
-
|
| 809 |
-
|
| 810 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 811 |
st.session_state._trackio_logged_once = True
|
| 812 |
-
except Exception
|
| 813 |
-
|
| 814 |
-
print(f"Trackio logging skipped: {_trackio_err}")
|
| 815 |
|
| 816 |
# Display the GPT prompt in an expander
|
| 817 |
if 'prompt' in st.session_state.analysis_data:
|
|
|
|
| 791 |
|
| 792 |
# Show action buttons and their results (only if analysis is complete)
|
| 793 |
if st.session_state.video_analyzed:
|
| 794 |
+
# Best-effort Trackio logging once per analyzed video (async, non-blocking)
|
| 795 |
if not st.session_state.get("_trackio_logged_once"):
|
| 796 |
try:
|
| 797 |
+
import threading
|
| 798 |
+
def _log_trackio_async():
|
| 799 |
+
try:
|
| 800 |
+
import trackio
|
| 801 |
+
data = st.session_state.analysis_data
|
| 802 |
+
frames = data.get('frames')
|
| 803 |
+
detections = data.get('detections')
|
| 804 |
+
trackio.init(project="par-ity-golf-swing", config={
|
| 805 |
+
"input_method": "YouTube URL" if isinstance(data.get('video_path'), str) and 'youtube' in data.get('video_path', '').lower() else "upload",
|
| 806 |
+
"sample_rate": data.get('sample_rate', 1)
|
| 807 |
+
})
|
| 808 |
+
trackio.log({
|
| 809 |
+
"swings_analyzed": 1,
|
| 810 |
+
"frames_processed": len(frames) if frames is not None else 0,
|
| 811 |
+
"num_detections": len(detections) if detections is not None else 0
|
| 812 |
+
})
|
| 813 |
+
trackio.finish()
|
| 814 |
+
except Exception:
|
| 815 |
+
pass
|
| 816 |
+
t = threading.Thread(target=_log_trackio_async, daemon=True)
|
| 817 |
+
t.start()
|
| 818 |
st.session_state._trackio_logged_once = True
|
| 819 |
+
except Exception:
|
| 820 |
+
pass
|
|
|
|
| 821 |
|
| 822 |
# Display the GPT prompt in an expander
|
| 823 |
if 'prompt' in st.session_state.analysis_data:
|