"""PROCESSING screen — a staged reveal. The generator that drives it lives in app.py (it also toggles screens and produces the final card); this module owns the screen + fact-rendering HTML. Real parsed facts feed the reveal (Task 2); scores are computed after (Task 3). """ from __future__ import annotations import gradio as gr def build(): with gr.Column(visible=False, elem_id="screen-processing") as col: gr.HTML("
Reading your conversations…
") log = gr.HTML(elem_id="omc-proclog") return col, {"log": log} def wrap(lines: list[str]) -> str: return "
" + "".join(lines) + "
" def fact(text: str, muted: bool = False) -> str: cls = "omc-fact muted" if muted else "omc-fact" return f"
{text}
" def error(text: str) -> str: """A prominent error row — shown instead of a fake card when scoring can't produce real results.""" from html import escape return (f"
" f"⚠ Couldn't score this
{escape(text)}
") def fact_num(n: int, label: str) -> str: return (f"
" f"{n:,} {label}
") def progress_bar(done: int, total: int, label: str = "signals analyzed") -> str: """Live scoring bar. total==0 (counts not known yet) renders an indeterminate sweep.""" if total <= 0: return ("
" "
" f"
{label}…
") pct = max(0, min(100, round(100 * done / total))) return ( "
" f"
" "
" f"{done:,} / {total:,} {label}" f"{pct}%
" ) def lang_block(english: int, other: int) -> str: total = max(english + other, 1) en_pct = 100 * english / total return ( "
" f"
English {english:,} scored " f"/ other {other:,} not scored
" f"
" f"
" f"
{en_pct:.0f}% of turns scored
" "
" )