import React, { useEffect, useRef, useState } from 'react' import { PandaIllustration, Icon, LoopIcon } from './Icons.jsx' import { api, postJson } from './api.js' import { Session } from './Session.jsx' import { clearDraft } from './useDraft.js' import { Lab } from './Lab.jsx' const policyNames = { fixed: 'Fixed practice', adaptive: 'Adaptive practice', comparison: 'Compare approaches', 'learning-fixed': 'Reading outcome: fixed', 'learning-epsilon': 'Reading outcome: epsilon greedy', 'learning-linucb': 'Reading outcome: LinUCB', 'learning-comparison': 'Reading outcome: randomized comparison' } export function App() { const [language, setLanguage] = useState('en') const [split, setSplit] = useState('practice') const [mode, setMode] = useState('fixed') const [view, setView] = useState('reading') const [catalog, setCatalog] = useState([]) const [sessions, setSessions] = useState([]) const [selected, setSelected] = useState(null) const [health, setHealth] = useState(null) const [report, setReport] = useState(null) const [benchmark, setBenchmark] = useState(null) const [error, setError] = useState('') const [loading, setLoading] = useState(false) const [opening, setOpening] = useState(false) const [remove, setRemove] = useState(null) const [attempt, setAttempt] = useState(0) const pendingStart = useRef(null) useEffect(() => { const controller = new AbortController() setLoading(true) setError('') setCatalog([]); setSessions([]); setReport(null) Promise.all([ api('/health', { signal: controller.signal }), api(`/passages?language=${language}&split=${split}`, { signal: controller.signal }), api(`/sessions?language=${language}`, { signal: controller.signal }), api(`/policy-report?language=${language}`, { signal: controller.signal }), api('/benchmarks/latest', { signal: controller.signal }), ]).then(([status, passages, saved, comparison, measured]) => { if (controller.signal.aborted) return setHealth(status); setCatalog(passages); setSessions(saved); setReport(comparison); setBenchmark(measured) if (status.pilot) { setLanguage(status.pilot.language) setMode(status.pilot.arm) if (status.pilot.next) setSplit(status.pilot.next.stage === 'practice' ? 'practice' : 'evaluation') } }).catch(failure => { if (!controller.signal.aborted) setError(failure.message) }).finally(() => { if (!controller.signal.aborted) setLoading(false) }) return () => controller.abort() }, [language, split, attempt]) async function openPassage(passageId) { if (opening) return setOpening(true); setError('') try { if (!pendingStart.current || pendingStart.current.passage_id !== passageId || pendingStart.current.mode !== mode) pendingStart.current = { id: health?.pilot?.next?.session_id || crypto.randomUUID(), passage_id: passageId, mode } const created = await postJson('/sessions', pendingStart.current) const saved = await api(`/sessions/${created.id}`) pendingStart.current = null setSelected(saved) } catch (failure) { setError(failure.message); setAttempt(value => value + 1) } finally { setOpening(false) } } async function resume(id) { setOpening(true); setError('') try { setSelected(await api(`/sessions/${id}`)) } catch (failure) { setError(failure.message) } finally { setOpening(false) } } async function deleteSaved() { setOpening(true); setError('') try { await api(`/sessions/${remove.id}`, { method: 'DELETE' }); clearDraft(remove.id); setRemove(null); setAttempt(value => value + 1) } catch (failure) { setError(failure.message) } finally { setOpening(false) } } function leave() { setSelected(null); setAttempt(value => value + 1) } const visible = catalog.filter(p => split !== 'evaluation' || !sessions.some(session => session.passage_id === p.id)) const finished = sessions.filter(session => session.status === 'completed') const active = sessions.filter(session => session.status === 'active') const measured = benchmark?.languages?.find(item => item.language === language) const pilot = health?.pilot if (pilot && health.version === '0.10.0') return

Continue your pilot

This participant uses the original study version. Open its preserved reading interface to continue.

Open pilot reading
return
Skip to content
{selected && }{selected ? 'Reading session' : { reading: 'Reading practice', progress: 'Saved progress', compare: 'Practice comparison', lab: 'Experiments', setup: 'Demo setup' }[view]}18+
{selected ? {}} onLeave={leave} /> : <>

{{ reading: 'Let’s read.', progress: 'Your progress', compare: 'Compare approaches', lab: 'Experiments', setup: 'Demo setup' }[view]}

{view === 'reading' ? 'A short passage. Your own pace.' : 'Temporary progress for this visit. Separate results for each language.'}

{error &&

{error}

} {loading &&

Loading saved data...

} {pilot &&
{pilot.next ? `Pilot reading ${pilot.completed + 1} of ${pilot.total}` : 'Pilot readings complete. Thank you.'}

{pilot.notice}

For this pilot, save a recording and review its transcript before the exercise. You can type a transcript if recognition fails.

To stop, choose Leave session. To withdraw your data, contact: {pilot.contact}.

Your participant code{pilot.code}

Personal data deletion deadline: {new Date(pilot.delete_by).toLocaleDateString()}

} {view === 'reading' && <>
{split === 'practice' && !pilot ?

{mode.startsWith('learning-') ? 'Experimental: chooses exercise type and reading support. A later reviewed practice reading supplies a delayed reward. This does not establish learning improvement.' : mode === 'fixed' ? 'Consistent rules choose an exercise from your word review.' : mode === 'adaptive' ? 'Uses past exercise answers in this language and occasionally tries another exercise.' : 'Randomly assigns fixed or adaptive selection for a fairer comparison. No approach is known to be better yet.'}

:

{pilot && split === 'practice' ? 'Follow the assigned practice sequence. The same two passages repeat in this feasibility pilot. ' : 'Unseen passages are kept separate from practice. '} Once opened, a passage stays marked as seen during this visit. Expiry or a server restart resets that record. These checks do not train the exercise policy.

} {active.length > 0 &&

You have {active.length} unfinished session{active.length === 1 ? '' : 's'} in this language.

}
{visible.map(p =>

{p.title}

{p.word_count} words / {language === 'en' ? 'English' : 'Greek'}

)}{!loading && !error && !visible.length &&

{pilot && !pilot.next ? 'All eight pilot readings are complete. The organiser can now prepare the human review.' : 'No unseen passages remain in this language. Resume an unfinished check from Progress, or return to practice.'}

}
} {view === 'progress' &&

Continue a session

{!active.length &&

No unfinished sessions.

}
    {active.map(row =>
  • {row.title || row.passage_id}{row.split === 'evaluation' ? 'Unseen check' : policyNames[row.mode]} / {row.has_audio ? 'Recording saved' : 'No saved recording'}
    {!pilot && }
  • )}
{['practice', 'evaluation'].map(group =>

{group === 'practice' ? 'Practice history' : 'Unseen checks'}

{!finished.some(row => row.split === group) &&

No completed sessions yet.

}
    {finished.filter(row => row.split === group).map(row =>
  • {row.title || row.passage_id}Exercise: {row.result.exercise_correct ? 'correct' : 'reviewed'} / {row.result.suggestions_kept === null ? 'self-review' : `${row.result.suggestions_kept} suggestions kept`}{new Date(row.updated_at).toLocaleString()} / {row.decision?.policy} / {row.result.source}{row.result.word_difference_rate !== null ? ` / text difference rate ${(row.result.word_difference_rate * 100).toFixed(1)}%` : ''}
    {!pilot && }
  • )}
)}

Text differences can come from recognition errors. These are not pronunciation scores. Passages are not calibrated for difficulty, so differences across sessions do not by themselves establish improvement.

{remove &&

Delete this session’s transcript, recording, and result? This cannot be undone in the app. Existing backups may still contain it. Evaluation passages remain marked as seen.

}
} {view === 'compare' &&

Randomized practice comparison

Choose “Compare approaches” when starting practice to contribute an outcome. Directly selected fixed or adaptive sessions are excluded from this comparison.

{report?.arms.map(arm => )}
ApproachAssignedAnsweredCompletedCorrect answers95% interval
{policyNames[arm.policy]}{arm.assigned}{arm.answered}{arm.completed}{arm.success_rate === null ? 'No data' : `${(arm.success_rate * 100).toFixed(1)}%`}{arm.wilson_95 ? arm.wilson_95.map(value => `${(value * 100).toFixed(0)}%`).join(' to ') : 'No data'}

{report?.notice}

Correct exercise answers are a useful check, but they do not prove better reading. Adaptive selection may favour easier exercises. No winner is declared.

} {view === 'lab' && !pilot && } {view === 'setup' &&
Backend{health ? 'Connected' : 'Unavailable'}
Hosted speech model{health?.speech?.ready ? `${health.speech.model?.split('/').pop()} / ZeroGPU` : 'Not ready'}

Temporary data

{pilot ? 'This pilot participant has a separate local database.' : 'One temporary visitor profile, separate from other visitors.'} Progress and recordings expire after one hour of inactivity or a Space restart. Use Progress to resume or delete a session.

{pilot ? "The organiser manages pilot data and withdrawal. Avoid creating extra copies of participant recordings." : "The public demo does not provide durable storage or backups."}

Speech benchmark

{measured ? <>

Measured model: {benchmark.model}. The report describes this model, which may differ from an environment override.

{measured.samples} FLEURS {benchmark.partition === 'holdout' ? 'held-out' : 'test'} clips / {language === 'en' ? 'English' : 'Greek'} / CPU INT8.

Word error rate
{(measured.word_error_rate * 100).toFixed(1)}%
Successful warm median
{measured.warm_latency_p50_seconds == null ? 'No success' : `${measured.warm_latency_p50_seconds}s`}
Successful warm p95
{measured.warm_latency_p95_seconds == null ? 'No success' : `${measured.warm_latency_p95_seconds}s`}

{measured.failed_warm_runs} failed attempts out of {measured.warm_runs ?? measured.samples * 2} warm runs. Rejected clips remain in the accuracy result; successful runs alone determine the latency figures.

{benchmark.limitations}

:

This hosted inference adapter has not been benchmarked. Local CPU results do not describe this deployment.

}
} }
}