"""The "Try a screenshot" view: ground one instruction on your own screenshot. Plain HTML + script inside one gr.HTML. The image is sent with the component's `upload()` helper, and grounding runs through a server function, so no stock Gradio widgets are involved. Example screenshots are served as static files. """ TEMPLATE = '
' SCRIPT = r""" const EX = props.examples || [], MODELS = props.models || []; const st = { path: null, preview: null, text: '', model: MODELS[0], busy: false, out: null, err: '' }; const root = element.querySelector('.dsh') || element; const esc = s => String(s ?? '').replace(/[&<>"]/g, c => ({'&': '&', '<': '<', '>': '>', '"': '"'}[c])); function render() { root.innerHTML = `