"""Run the real Gradio UI with deterministic UDPipe responses for browser QA.""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[2])) from build_preview import ENGLISH, GERMAN import app def parse_fixture(text, model, strip_morphology=True, cache=None): conllu = GERMAN if model.startswith('german') else ENGLISH if 'gum' in model or 'gsd' in model: conllu = conllu.replace('\tnsubj\t', '\tobj\t') # Include the normal UDPipe sentence terminator to exercise normalization. return {'conllu': conllu + '\n', 'model': model, 'error': None} app.client.parse_sentence = parse_fixture app.demo.launch(server_port=7871, **app._launch_kwargs)