import streamlit as st from visual_eval.evaluator import HebrewTextNormalizer from visual_eval.visualization import render_visualize_jiwer_result_html from substitutions_visualizer import visualize_substitutions from utils import display_rtl norm = HebrewTextNormalizer() @st.fragment def manual_eval_viz(ref, hyp): show_subs = st.toggle("Show Substitutions", value=False) norm_texts = st.toggle("Normalize Texts", value=True) if norm_texts: ref = norm(ref) hyp = norm(hyp) html = render_visualize_jiwer_result_html(ref, hyp) display_rtl(html) if show_subs: visualize_substitutions(ref, hyp) def render_manual_eval(): col_ref, col_hyp = st.columns([1, 1], gap="small") ref = None hyp = None with col_ref: ref = st.text_area("Reference Text", height=100) with col_hyp: hyp = st.text_area("Hypothesis Text", height=100) if st.button("Visualize"): if hyp and ref: manual_eval_viz(ref, hyp) else: st.error("Please enter both reference and hypothesis text.")