-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
99 lines (83 loc) · 2.89 KB
/
app.py
File metadata and controls
99 lines (83 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"""GAZE2CodeToolkit — Streamlit web wrapper.
Run from inside the GAZE2CodeToolkit/ directory:
streamlit run app.py
The four tabs mirror the five CLI scripts (extract / aoi / visualize /
evaluate_ocr). The "score_expertise" CLI is intentionally not surfaced
as a tab — it is a one-shot batch operation on a CSV the user already
has, so the CLI is the natural entry point.
"""
from __future__ import annotations
import streamlit as st
st.set_page_config(
page_title="GAZE2CodeToolkit",
page_icon="👁️",
layout="wide",
initial_sidebar_state="collapsed",
)
# Tabs are imported AFTER set_page_config so any st.* call they trigger
# at import time happens inside the configured app.
from webapp.tabs import aoi, evaluate, extract, onboard, visualize # noqa: E402
def main() -> None:
st.title("GAZE2CodeToolkit")
st.caption(
"Eye-tracking → semantic gaze pipeline · Tobii TSV → OCR token AOIs → "
"fixation×AOI tables. Web wrapper around the CLI scripts in `cli/`."
)
with st.sidebar:
st.subheader("About")
st.write(
"Tabs above mirror the four interactive CLI scripts. "
"Choose a dataset on the **Extract** tab to begin, or jump "
"straight to **AOI Detection** if you already know which "
"trial you want."
)
st.divider()
st.write("**Available datasets**")
try:
from g2c.parsers import available_datasets
for d in available_datasets():
st.write(f"• `{d}`")
except Exception as e:
st.warning(f"Parser package failed to import: {e}")
st.divider()
st.caption("Streamlit app · GAZE2CodeToolkit")
tabs = st.tabs([
"🔧 Onboard Tobii",
"📥 Extract",
"🔎 AOI Detection",
"🎨 Visualize",
"✅ Evaluate OCR",
])
with tabs[0]:
onboard.render()
with tabs[1]:
extract.render()
with tabs[2]:
aoi.render()
with tabs[3]:
visualize.render()
with tabs[4]:
evaluate.render()
_render_footer()
def _render_footer() -> None:
"""Site-wide footer with copyright + author info.
Rendered as raw HTML inside `st.markdown` so it lays out as a
single small grey line below the active tab content. Streamlit's
own elements add too much vertical padding for a footer this
short.
"""
st.divider()
st.markdown(
"""
<div style="text-align: center; color: #888; font-size: 0.85em;
padding: 8px 0 16px;">
© 2026 Wudao (Dylan) Yang
<<a href="mailto:dylanyang963@gmail.com"
style="color: #888;">dylanyang963@gmail.com</a>>
· GAZE2CodeToolkit · gaze-based programmer-expertise research
</div>
""",
unsafe_allow_html=True,
)
if __name__ == "__main__":
main()