Lara Monteagudo Tubau commited on
Commit Β·
fa5ff78
1
Parent(s): 7d23ffa
style: restore original hero + three-card home screen and cc-* palette
Browse files124 unmodified lines12512612712812812913013113113213313410 unmodified lines145146147148148149150151156 unmodified lines30830931031131131231331415 unmodified lines33033133233333333433533615 unmodified lines35235335435535535635735823 unmodified lines38238338438538538638738812 unmodified lines40140240340440440540640740840941041041141241241341441441541641731 unmodified lines44945045145245245345445545 unmodified lines5015025035045045055065076 unmodified lines51451551651751751851952062 unmodified lines583584585586587588589586587588589590591592100 unmodified lines693694695696696697698698699700701135 unmodified lines83783883984084084184284384284384484584694 unmodified lines94194294394494494594694729 unmodified lines97797897998098098198298398498598698798798898999054 unmodified lines1045104610471048104810491050105010511052105324 unmodified lines1078107910801081108110821083108497 unmodified lines118211831184118511851186118711881188118911901191560 unmodified lines17521753175417551755175617571758175917601761176217631764176517661767176817571758175917601761176217631764176517661771177217731774177517671768176917701771177217731777177817791780177417821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807177517761777177817791780178117821783178418091810181118121785178617871788178917901815179117921793179417951796182118221797179817991800182518261801180218031804180518301806180718081833180918101811183618371812181318141815184018161817184218431844184518461818181918201821182218481849185018511852185318231824182518261827182818291830185518561857185818311832183318341835183618371838186118621863186418651866186718681869183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865187118721873186618671868186918701871187218731874187518761877187818791880187618771881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908187918801881190919101911191219131914191518831916191719181886188719191920192118891922192318911924192518931894192619271928192919301931189919321933190119341935190319041905190619361937193842 unmodified lines1981198219831955195619571958195919601961196219631964196519661967198419851986198719881989199019911992197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005199319941995199619971998199920002001200220032004200520062007200820092010200720112012201320102014201520162017201820192020202120222023202420252026201520272028202920182030203120322033203420352036203720382039204020212041204220432044204520462047204820492050205120522053124 unmodified lines
# SSRL metacognitive phases β shown alongside D1-D9 in Review tabSSRL_PHASES = [ ("M-MON", "Metacognitive Monitoring", "#ea580c", "#fff7ed"), ("M-MON", "Metacognitive Monitoring", "#ff5a3d", "#fff5f2"), ("M-REG", "Metacognitive Regulation", "#065f46", "#ecfdf5"), ("CO-REG", "Co-Regulation", "#b45309", "#fffbeb"), ("SSRL", "Socially Shared Regulation", "#9a3412", "#fff7ed"), ("SSRL", "Socially Shared Regulation", "#7c2d12", "#fff5f2"), ("NONE", "Not Metacognitive", "#64748b", "#f8fafc"),]
10 unmodified linesSEC_ID_FROM_CHOICE = {SEC_NONE: None, **DIM_ID_FROM_CHOICE}
SPEAKER_PALETTE = [ ("#ea580c", "#fff7ed", "#fed7aa", "π "), ("#ff5a3d", "#fff5f2", "#ffc5b5", "π "), ("#0e7490", "#ecfeff", "#a5f3fc", "π·"), ("#065f46", "#ecfdf5", "#a7f3d0", "π’"), ("#6b21a8", "#faf5ff", "#e9d5ff", "π£"),156 unmodified lines if i < cur_idx: bg, tc, border, dot = "#dcfce7", "#15803d", "#86efac", "β" elif i == cur_idx: bg, tc, border, dot = "#fff7ed", "#c2410c", "#fdba74", "βΆ" bg, tc, border, dot = "#fff5f2", "#ea4425", "#ff8c75", "βΆ" else: bg, tc, border, dot = "#fafaf9", "#a8a29e", "#e7e5e4", "β" steps.append(15 unmodified lines f'align-items:center;gap:16px;flex-wrap:wrap;font-family:Inter,system-ui,sans-serif">' f'<div style="display:flex;align-items:center;gap:10px;margin-right:8px">' f'<div style="width:8px;height:8px;border-radius:50%;' f'background:#ea580c;box-shadow:0 0 0 3px #ffedd5"></div>' f'background:#ff5a3d;box-shadow:0 0 0 3px #fff5f2"></div>' f'<div style="line-height:1.3">' f'<div style="font-weight:800;color:#1c1917;font-size:0.88em;' f'letter-spacing:-0.01em">{session}</div>'15 unmodified lines "success": ("#f0fdf4", "#065f46", "#86efac", "β"), "error": ("#fef2f2", "#991b1b", "#fca5a5", "β"), "warning": ("#fffbeb", "#78350f", "#fbbf24", "β "), "processing": ("#fff7ed", "#9a3412", "#fdba74", "β³"), "processing": ("#fff5f2", "#7c2d12", "#ff8c75", "β³"), } bg, tc, bc, icon = colors.get(status, colors["success"]) detail_html = ""23 unmodified lines
def _loading_card(title: str, subtitle: str = "Please waitβ¦", spin: str = "β") -> str: return ( '<div style="background:#fff7ed;border:2px solid #fdba74;border-radius:12px;' '<div style="background:#fff5f2;border:2px solid #ff8c75;border-radius:12px;' 'padding:18px 20px;margin:10px 0;font-family:system-ui,sans-serif">' '<div style="display:flex;align-items:center;gap:12px">' f'<div style="font-size:1.35em;color:#7c2d12">{spin}</div>'12 unmodified lines circ_icon = "β" if circ == "CLOSED" else "β " if circ == "HALF_OPEN" else "β" eta_str = f"~{remaining}s" if remaining > 5 else "finishingβ¦" return ( f'<div style="background:#fff7ed;border:2px solid #fdba74;' f'<div style="background:#fff5f2;border:2px solid #ff8c75;' f'border-radius:12px;padding:16px 20px;font-family:system-ui,sans-serif">' f'<div style="display:flex;align-items:center;gap:10px;margin-bottom:12px">' f'<span style="font-size:1.3em">{spinner}</span>' f'<span style="font-weight:700;color:#7c2d12;font-size:0.94em">{_h(message)}</span>' f'<span style="margin-left:auto;font-family:monospace;font-size:0.84em;' f'background:#ffedd5;padding:3px 9px;border-radius:6px;color:#9a3412">' f'background:#fff5f2;padding:3px 9px;border-radius:6px;color:#7c2d12">' f'{elapsed}s elapsed</span></div>' f'<div style="background:#ffedd5;border-radius:5px;height:9px;' f'<div style="background:#fff5f2;border-radius:5px;height:9px;' f'margin-bottom:10px;overflow:hidden">' f'<div style="height:100%;width:{pct}%;background:#ea580c;border-radius:5px"></div>' f'<div style="height:100%;width:{pct}%;background:#ff5a3d;border-radius:5px"></div>' f'</div>' f'<div style="display:flex;flex-wrap:wrap;gap:14px;font-size:0.8em;color:#475569">' f'<span>Est: ~{est_total}s</span>'31 unmodified lines f'<span style="font-size:0.72em;color:#94a3b8">{ts} Β· {runtime}s</span>' f'</div>' f'<div style="font-size:0.76em;color:#94a3b8">model: ' f'<strong style="color:#ea580c">{model}</strong></div>' f'<strong style="color:#ff5a3d">{model}</strong></div>' f'{extra_lines}' f'</div>' )45 unmodified lines if score >= 0.40: return "#fef9c3", "#854d0e" if score >= 0.2: return "#fff7ed", "#c2410c" return "#fff5f2", "#ea4425" return "#f8fafc", "#94a3b8"
6 unmodified lines return ( f'<div style="display:flex;gap:12px;flex-wrap:wrap;' f'font-family:system-ui,sans-serif;margin-bottom:16px">' + _stat_chip(str(total), "Total turns", "#ea580c", "#fff7ed") + _stat_chip(str(total), "Total turns", "#ff5a3d", "#fff5f2") + _stat_chip(str(flagged), "Flagged turns", "#065f46", "#dcfce7") + _stat_chip(str(windows), "Candidate windows", "#b45309", "#fffbeb") + _stat_chip(f"{savings:.0%}", "LLM savings", "#be123c", "#fef2f2")62 unmodified lines ph = hit.get("phase", "") lbl = hit.get("category_label", "") tier = hit.get("tier", 1) tchip_bg = {"planning": "#fff7ed", "monitoring": "#f0fdf4", "evaluating": "#fff7ed", "ssrl": "#faf5ff"}.get(ph, "#f8fafc") tchip_c = {"planning": "#c2410c", "monitoring": "#15803d", "evaluating": "#c2410c", "ssrl": "#7c3aed"}.get(ph, "#64748b") tchip_bg = {"planning": "#fff5f2", "monitoring": "#f0fdf4", "evaluating": "#fff5f2", "ssrl": "#faf5ff"}.get(ph, "#f8fafc") tchip_c = {"planning": "#ea4425", "monitoring": "#15803d", "evaluating": "#ea4425", "ssrl": "#7c3aed"}.get(ph, "#64748b") tier_mark = "β¨2β©" if tier == 2 else "β¨3?β©" if tier == 3 else "" trigger_chips += ( f'<span style="background:{tchip_bg};color:{tchip_c};font-size:0.68em;'100 unmodified lines return '<p style="color:#94a3b8">Lexicon file not found.</p>'
phase_colors = { "planning": ("#c2410c", "#fff7ed", "#ffedd5"), "planning": ("#ea4425", "#fff5f2", "#fff5f2"), "monitoring": ("#15803d", "#f0fdf4", "#dcfce7"), "evaluating": ("#c2410c", "#fff7ed", "#fed7aa"), "evaluating": ("#ea4425", "#fff5f2", "#ffc5b5"), "ssrl": ("#7c3aed", "#faf5ff", "#e9d5ff"), }
135 unmodified lines
def _dim_badge(did: str) -> str: colors = { "D1": ("#ea580c","#fff7ed"), "D2": ("#0e7490","#ecfeff"), "D1": ("#ff5a3d","#fff5f2"), "D2": ("#0e7490","#ecfeff"), "D3": ("#065f46","#ecfdf5"), "D4": ("#b45309","#fffbeb"), "D5": ("#6b21a8","#faf5ff"), "D6": ("#9a3412","#fff7ed"), "D7": ("#9a3412","#ffedd5"), "D8": ("#be123c","#fef2f2"), "D5": ("#6b21a8","#faf5ff"), "D6": ("#7c2d12","#fff5f2"), "D7": ("#7c2d12","#fff5f2"), "D8": ("#be123c","#fef2f2"), "D9": ("#374151","#f3f4f6"), "NS": ("#78716c","#f5f5f4"), "NA": ("#94a3b8","#f8fafc"), }94 unmodified lines
header = ( f'<div style="display:flex;gap:10px;margin-bottom:14px;flex-wrap:wrap">' + _stat_chip(str(total), "Segments", "#ea580c", "#fff7ed") + _stat_chip(str(total), "Segments", "#ff5a3d", "#fff5f2") + _stat_chip(str(coded), "D1-D9 coded", "#065f46", "#dcfce7") + _stat_chip(str(ssrl_ct), "SSRL tagged", "#7c3aed", "#faf5ff") + f'</div>'29 unmodified lines f'{s["end_turn_id"]} ({n} turns Β· {pct}%)</div>' f'<div style="height:4px;background:#e2e8f0;border-radius:2px;' f'margin-top:8px;overflow:hidden">' f'<div style="height:100%;width:{pct}%;background:#ea580c;border-radius:2px">' f'<div style="height:100%;width:{pct}%;background:#ff5a3d;border-radius:2px">' f'</div></div>' f'</div>' ) return ( f'<div style="font-family:system-ui,sans-serif">' f'<div style="display:flex;gap:8px;margin-bottom:10px;flex-wrap:wrap">' + _stat_chip(str(n_turns), "Turns", "#ea580c", "#fff7ed") + _stat_chip(str(n_turns), "Turns", "#ff5a3d", "#fff5f2") + _stat_chip(str(len(sections)), "Sections", "#065f46", "#dcfce7") + _stat_chip(str(n_speakers), "Speakers", "#b45309", "#fffbeb") + _stat_chip(f"{elapsed}s", "Agent 0", "#7c3aed", "#faf5ff")54 unmodified lines if not desc: return "" return ( f'<div style="background:#fff7ed;border-left:3px solid #ea580c;' f'<div style="background:#fff5f2;border-left:3px solid #ff5a3d;' f'border-radius:0 6px 6px 0;padding:7px 12px;font-size:0.85em;' f'color:#9a3412;margin-top:6px">{_h(desc)}</div>' f'color:#7c2d12;margin-top:6px">{_h(desc)}</div>' )
24 unmodified lines f'<div style="font-size:0.82em;color:#64748b">Episode {min(cidx,total-1)+1} of {total}</div>' f'</div>' f'<div style="height:6px;background:#e2e8f0;border-radius:3px;overflow:hidden">' f'<div style="height:100%;width:{pct}%;background:#ea580c;border-radius:3px"></div>' f'<div style="height:100%;width:{pct}%;background:#ff5a3d;border-radius:3px"></div>' f'</div>' f'<div style="display:flex;justify-content:space-between;margin-top:4px;' f'font-size:0.75em;color:#94a3b8">'97 unmodified lines f'padding:12px 14px;margin-bottom:8px;background:#fffbeb">' f'<div style="display:flex;align-items:center;gap:10px;margin-bottom:6px">' f'<span style="font-family:monospace;font-size:0.8em;color:#78350f">{_h(sid)}</span>' f'<span style="background:#fff7ed;color:#c2410c;font-weight:700;' f'<span style="background:#fff5f2;color:#ea4425;font-weight:700;' f'padding:2px 8px;border-radius:4px">R1: {r1}</span>' f'<span style="color:#94a3b8">vs</span>' f'<span style="background:#fff7ed;color:#c2410c;font-weight:700;' f'<span style="background:#fff5f2;color:#ea4425;font-weight:700;' f'padding:2px 8px;border-radius:4px">R2: {r2}</span>' f'</div>' f'<div style="font-size:0.82em;color:#64748b;font-style:italic">{rat}</div>'560 unmodified lines# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
CUSTOM_CSS = """/* ββ Brand palette βββββββββββββββββββββββββββββββββββββ *//* ββ Palette (matches original) βββββββββββββββββββββββ */:root { --primary: #ea580c; --primary-dark: #c2410c; --primary-darker: #7c2d12; --primary-light: #fff7ed; --primary-border: #fed7aa; --primary-mid: #fdba74; --surface: #ffffff; --surface-alt: #fafaf9; --border: #e7e5e4; --text: #1c1917; --text-muted: #78716c; --text-faint: #a8a29e; --cc-bg: #ececee; --cc-surface: #f6f6f7; --cc-paper: #ffffff; --cc-ink: #111217; --cc-muted: #6b6f76; --cc-border: #d8dade; --cc-accent: #ff5a3d; --cc-accent-deep: #ea4425;}
/* ββ Global reset & type βββββββββββββββββββββββββββββββ */body, .gradio-container { font-family: system-ui, -apple-system, sans-serif !important; background: #fafaf9 !important; color: #1c1917 !important;/* ββ Global ββββββββββββββββββββββββββββββββββββββββββββ */.gradio-container { max-width: 1200px !important; margin: 0 auto !important; background: var(--cc-bg) !important; font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif !important;}
/* ββ App shell β remove Gradio's default grey box ββββ */.gradio-container > .main > .wrap { padding: 0 !important; }.gradio-container { max-width: 100% !important; padding: 0 !important; }footer { display: none !important; }
/* ββ Branded top header βββββββββββββββββββββββββββββββββ */.cc-header { background: linear-gradient(135deg, #7c2d12 0%, #ea580c 60%, #f97316 100%); padding: 18px 32px; display: flex; align-items: center; gap: 16px; box-shadow: 0 2px 12px rgba(234,88,12,0.25);}.cc-header-logo { font-size: 1.6em; font-weight: 900; color: white; letter-spacing: -0.03em;}.cc-header-logo span { opacity: 0.7; font-weight: 400; }.cc-header-tag { font-size: 0.72em; background: rgba(255,255,255,0.18); color: white; padding: 3px 10px; border-radius: 20px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;:focus-visible { outline: 2px solid var(--cc-accent) !important; outline-offset: 2px; }:focus { outline: none; }
/* ββ Buttons βββββββββββββββββββββββββββββββββββββββββββ */.gradio-container button.primary { background: var(--cc-accent) !important; border-color: var(--cc-accent) !important; color: #fff !important; font-weight: 700 !important;}.cc-header-right { margin-left: auto; font-size: 0.78em; color: rgba(255,255,255,0.65);.gradio-container button.primary:hover { background: var(--cc-accent-deep) !important; border-color: var(--cc-accent-deep) !important;}.gradio-container button:not(.primary) { border-color: #c9cdd3 !important; }
/* ββ Pipeline status bar βββββββββββββββββββββββββββββββ *//* ββ Pipeline header βββββββββββββββββββββββββββββββββββ */.pipeline-header { position: sticky; top: 0; z-index: 100; background: white; border-bottom: 2px solid var(--primary-border); box-shadow: 0 2px 8px rgba(234,88,12,0.08); border-bottom: 2px solid var(--cc-border); box-shadow: 0 2px 8px rgba(234,88,12,0.07);}
/* ββ Tabs βββββββββββββββββββββββββββββββββββββββββββββββ */.tabs > .tab-nav { border-bottom: 2px solid var(--primary-border) !important; }/* ββ Tabs ββββββββββββββββββββββββββββββββββββββββββββββ */.tabs > .tab-nav { border-bottom: 2px solid var(--cc-border) !important; }.tabs > .tab-nav button { font-weight: 700 !important; font-size: 0.88em !important; color: var(--text-muted) !important; color: var(--cc-muted) !important; padding: 10px 18px !important; border-radius: 0 !important; transition: color 0.15s, border-color 0.15s !important; transition: color 0.15s !important;}.tabs > .tab-nav button.selected { color: var(--primary) !important; border-bottom: 3px solid var(--primary) !important; color: var(--cc-accent) !important; border-bottom: 3px solid var(--cc-accent) !important; background: transparent !important;}.tabs > .tab-nav button:hover { color: var(--primary-dark) !important; }.tabs > .tab-nav button:hover { color: var(--cc-accent-deep) !important; }
/* ββ Cards / containers βββββββββββββββββββββββββββββββββ */.gr-box, .gr-panel, .gr-form { border-radius: 12px !important; border-color: var(--border) !important; box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;/* ββ Hero (original) βββββββββββββββββββββββββββββββββββ */.cc-hero { text-align: center; padding: 56px 24px 40px;}
/* ββ Inputs βββββββββββββββββββββββββββββββββββββββββββββ */input[type=text], textarea, .gr-input { border-color: var(--border) !important; border-radius: 8px !important; font-size: 0.9em !important;.cc-hero-title { font-size: clamp(3.5rem, 10vw, 7rem); font-weight: 900; letter-spacing: -0.06em; color: var(--cc-ink); line-height: 0.88; margin: 0 0 16px;}input[type=text]:focus, textarea:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(234,88,12,0.12) !important; outline: none !important;.cc-hero-sub { font-size: 1rem; color: var(--cc-muted); max-width: 44ch; margin: 0 auto 48px; line-height: 1.55;}
/* ββ Buttons ββββββββββββββββββββββββββββββββββββββββββββ */.gr-button-primary, button[class*="primary"] { background: linear-gradient(135deg, var(--primary-dark), var(--primary)) !important; border: none !important; color: white !important; font-weight: 700 !important; border-radius: 8px !important; box-shadow: 0 2px 8px rgba(234,88,12,0.3) !important; transition: opacity 0.15s, box-shadow 0.15s !important;/* ββ Entry cards (original) ββββββββββββββββββββββββββββ */.cc-entry-card { background: var(--cc-paper); border: 1px solid var(--cc-border); border-radius: 16px; padding: 24px; min-height: 190px; position: relative; overflow: hidden;}.cc-entry-card::after { content: ""; position: absolute; right: -24px; bottom: -24px; width: 96px; height: 96px; border-radius: 999px; background: rgba(255,90,61,0.1);}.cc-entry-kicker { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--cc-accent-deep); margin-bottom: 10px; display: block;}.gr-button-primary:hover, button[class*="primary"]:hover { opacity: 0.93 !important; box-shadow: 0 4px 14px rgba(234,88,12,0.4) !important;.cc-entry-title { font-size: 1.28rem; font-weight: 800; letter-spacing: -0.025em; color: var(--cc-ink); margin: 0 0 8px; line-height: 1.1;}.cc-entry-desc { font-size: 0.87rem; color: #434852; line-height: 1.55; max-width: 32ch;}
/* ββ Dropdowns ββββββββββββββββββββββββββββββββββββββββββ */.gr-dropdown { border-radius: 8px !important; }/* ββ Top header bar ββββββββββββββββββββββββββββββββββββ */.cc-header { background: linear-gradient(135deg, #7c2d12 0%, #ff5a3d 60%, #ff7a5a 100%); padding: 18px 32px; display: flex; align-items: center; gap: 16px; box-shadow: 0 2px 12px rgba(234,88,12,0.22);}.cc-header-logo { font-size: 1.6em; font-weight: 900; color: white; letter-spacing: -0.03em;}.cc-header-logo span { opacity: 0.65; font-weight: 400; }.cc-header-tag { font-size: 0.72em; background: rgba(255,255,255,0.18); color: white; padding: 3px 10px; border-radius: 20px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;}.cc-header-right { margin-left: auto; font-size: 0.78em; color: rgba(255,255,255,0.6); }
/* ββ Sliders ββββββββββββββββββββββββββββββββββββββββββββ */input[type=range]::-webkit-slider-thumb { background: var(--primary) !important; }input[type=range]::-webkit-slider-runnable-track { background: var(--primary-border) !important; }/* ββ Inputs ββββββββββββββββββββββββββββββββββββββββββββ */input[type=text]:focus, textarea:focus { border-color: var(--cc-accent) !important; box-shadow: 0 0 0 3px rgba(255,90,61,0.12) !important; outline: none !important;}
/* ββ Scrollbars βββββββββββββββββββββββββββββββββββββββββ *//* ββ Scrollbars ββββββββββββββββββββββββββββββββββββββββ */::-webkit-scrollbar { width: 6px; height: 6px; }::-webkit-scrollbar-track { background: #f5f5f4; }::-webkit-scrollbar-thumb { background: var(--primary-border); border-radius: 3px; }::-webkit-scrollbar-thumb:hover { background: var(--primary-mid); }::-webkit-scrollbar-thumb { background: #d8dade; border-radius: 3px; }::-webkit-scrollbar-thumb:hover { background: #ff5a3d; }
/* ββ Markdown headings ββββββββββββββββββββββββββββββββββ *//* ββ Markdown headings βββββββββββββββββββββββββββββββββ */.gr-markdown h2 { font-size: 1.25em !important; font-size: 1.22em !important; font-weight: 800 !important; color: var(--primary-darker) !important; border-bottom: 2px solid var(--primary-border) !important; color: var(--cc-ink) !important; border-bottom: 2px solid var(--cc-border) !important; padding-bottom: 8px !important; margin-bottom: 12px !important;}.gr-markdown h3 { font-size: 1.02em !important; font-size: 1.0em !important; font-weight: 700 !important; color: var(--primary-dark) !important; color: var(--cc-accent-deep) !important;}
/* ββ Accordion ββββββββββββββββββββββββββββββββββββββββββ */.gr-accordion { border-color: var(--primary-border) !important; border-radius: 10px !important; }.gr-accordion > .label { color: var(--primary-dark) !important; font-weight: 700 !important; }""" + _load_css()
42 unmodified lines # TAB 1 β SESSION # ================================================================ with gr.Tab("Session"): gr.Markdown("## Session Setup") gr.HTML("""<div style="font-family:system-ui,sans-serif;font-size:0.9em;color:#78716c; margin-bottom:20px;max-width:600px"> Enter your researcher ID, then choose how to load a transcript below. Your ID is used to namespace codings and keep sessions separate across researchers.</div>""") researcher_id = gr.Textbox( label="Researcher ID", placeholder="e.g. R1_Lara", info="Used to namespace your codings and Drive sessions.", scale=1, # ββ Hero βββββββββββββββββββββββββββββββββββββββββββββββββ gr.HTML( '<div class="cc-hero">' '<h1 class="cc-hero-title">CollabCode</h1>' '<p class="cc-hero-sub">Human-in-the-loop metacognitive talk detection ' 'for collaborative learning research</p>' '</div>' )
# Three cards gr.HTML("""<div style="display:grid;grid-template-columns:repeat(3,1fr);gap:16px; margin:20px 0;font-family:system-ui,sans-serif"> <div style="background:white;border:2px solid #fed7aa;border-radius:14px; padding:20px 20px 14px;box-shadow:0 2px 8px rgba(234,88,12,0.08)"> <div style="font-size:0.68em;font-weight:800;letter-spacing:0.1em; text-transform:uppercase;color:#ea580c;margin-bottom:6px">Option A</div> <div style="font-weight:800;font-size:1.05em;color:#1c1917;margin-bottom:4px"> Upload local file</div> <div style="font-size:0.82em;color:#78716c;line-height:1.5"> Upload a .txt, .vtt, or .srt transcript file from your computer.</div> </div> <div style="background:white;border:2px solid #e7e5e4;border-radius:14px; padding:20px 20px 14px;box-shadow:0 2px 8px rgba(0,0,0,0.04)"> <div style="font-size:0.68em;font-weight:800;letter-spacing:0.1em; text-transform:uppercase;color:#78716c;margin-bottom:6px">Option B</div> <div style="font-weight:800;font-size:1.05em;color:#1c1917;margin-bottom:4px"> Load from Drive</div> <div style="font-size:0.82em;color:#78716c;line-height:1.5"> Connect to Google Drive and pick a transcript from your shared folder.</div> </div> <div style="background:white;border:2px solid #e7e5e4;border-radius:14px; padding:20px 20px 14px;box-shadow:0 2px 8px rgba(0,0,0,0.04)"> <div style="font-size:0.68em;font-weight:800;letter-spacing:0.1em; text-transform:uppercase;color:#78716c;margin-bottom:6px">Option C</div> <div style="font-weight:800;font-size:1.05em;color:#1c1917;margin-bottom:4px"> Restore session</div> <div style="font-size:0.82em;color:#78716c;line-height:1.5"> Continue a previous coding session saved to Drive.</div> </div></div>""")
with gr.Row(): with gr.Column(scale=1): # ββ Three entry cards βββββββββββββββββββββββββββββββββββββ with gr.Row(equal_height=True): with gr.Column(scale=2): gr.HTML( '<div class="cc-entry-card">' '<span class="cc-entry-kicker">Primary workflow</span>' '<h3 class="cc-entry-title">Code a Transcript</h3>' '<p class="cc-entry-desc">Upload a Zoom transcript, run the ' 'metacognitive screener, let AI detect sections and segment ' 'boundaries, then code each episode against SSRL and D1-D9 dimensions.</p>' '</div>' ) gr.Markdown("**Researcher ID** β enter before loading a transcript") researcher_id = gr.Textbox( placeholder="e.g. R1_Lara", show_label=False, ) local_file = gr.File( label="A β Upload .txt / .vtt / .srt transcript", label="Upload .txt / .vtt / .srt transcript", file_types=[".txt", ".vtt", ".srt"], ) upload_btn = gr.Button("Load local file", variant="primary") upload_btn = gr.Button("Load local file", variant="primary", size="lg")
with gr.Column(scale=1): gr.HTML( '<div class="cc-entry-card">' '<span class="cc-entry-kicker">From Drive</span>' '<h3 class="cc-entry-title">Load from Drive</h3>' '<p class="cc-entry-desc">Connect to Google Drive and pick a ' 'transcript from your shared research folder.</p>' '</div>' ) refresh_drive_btn = gr.Button("Connect to Drive") drive_dropdown = gr.Dropdown( label="B β Select transcript from Drive", label="Select transcript", choices=[], interactive=False, ) drive_load_btn = gr.Button("Load from Drive") drive_load_btn = gr.Button("Load from Drive")
with gr.Column(scale=1): gr.HTML( '<div class="cc-entry-card">' '<span class="cc-entry-kicker">Continue</span>' '<h3 class="cc-entry-title">Restore Session</h3>' '<p class="cc-entry-desc">Pick up a previous coding session ' 'saved to Drive β all codings and screener results restored.</p>' '</div>' ) load_session_btn = gr.Button("C β Restore previous session") load_session_btn = gr.Button("Restore previous session")
gr.HTML( '<div style="text-align:center;padding:28px 0 12px;' 'font-size:0.75rem;color:#94a3b8;font-family:system-ui">' f'Model: <strong>{MODEL_ID.split("/")[-1]}</strong> Β· ' f'Temperature: {TEMPERATURE} Β· ' 'Frameworks: Iiskala et al. 2011 (SSRL) Β· Meier, Spada & Rummel 2007 (D1-D9)' '</div>' )
session_status = gr.HTML()
app.py+221-192