Simon Clematide
Update treebank data and models to UD 2.17, add PUD real-world examples, and expand Treebank Guide
c1704e3 Download tests/browser/run_app.py from simon-clmtd/universal-dependencies-visualizer: direct link, hf CLI and curl.
- Browser
- Download file 708 Bytes
-
https://huggingface.co/spaces/simon-clmtd/universal-dependencies-visualizer/resolve/main/tests/browser/run_app.py
- Command line
-
hf download hf://spaces/simon-clmtd/universal-dependencies-visualizer/tests/browser/run_app.py
-
curl -L -o run_app.py https://huggingface.co/spaces/simon-clmtd/universal-dependencies-visualizer/resolve/main/tests/browser/run_app.py
708 Bytes
| """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) | |