UNPKG

globalbridge-lsf-custom

Version:

GlobalBridge in-house labeling tool, originating from LSF.

183 lines (171 loc) • 5.67 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link rel="shortcut icon" href="/favicon.ico" /> <link rel="preconnect" href="https://fonts.gstatic.com" /> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" /> <meta name="theme-color" content="#000000" /> <link rel="stylesheet" href="/styles/main.css" /> <title>GB LSF CUSTOM</title> </head> <body> <noscript> You need to enable JavaScript to run this app. </noscript> <div id="label-studio"></div> <script> (function(d, o) { d.domReady = function(n, a) { (o.addEventListener && o.addEventListener("DOMContentLoaded", function e(t) { o.removeEventListener("DOMContentLoaded", e), n.call(a || d, t); })) || (o.attachEvent && o.attachEvent("onreadystatechange", function e(t) { "complete" === o.readyState && (o.detachEvent("onreadystatechange", e), n.call(a || d, t)); })); }; })(window, document); </script> <style> /*body {*/ /* height: 100%;*/ /*}*/ #label-studio { /*height: calc(100vh - 88px);*/ /*height: 100%;*/ z-index: 0; } </style> <script> domReady(function() { if (window.DISABLE_DEFAULT_LSF_INIT) { console.log("Default initialization prevented"); return false; } const lsfConfig = { description: "Description", config: ` <View style="width: 100%"> <Image name="img" value="$image" zoom="true"></Image> <View> <RectangleLabels name="tag" toName="img"> <Label value="Person" background="#4ade80"></Label> <Label value="Car" background="#fcba03"></Label> <Label value="Other" background="#2563eb"></Label> </RectangleLabels> </View> </View> `, interfaces: [ "topbar", "edit-history", "panel", "update", "submit", // "debug", "controls", ], // task: { // id: 77777, // data: { // title: "ITS Sample", // image: "/images/1.jpg", // }, // contents: {"result": []}, // isChecked: false, // }, modelType: "PSN", exhaustiveModelType: ["ABN"], images: [ { id: 71000, data: { title: "ITS Sample", image: "/images/1.jpg", }, contents: {result: []}, isChecked: false, }, { id: 71001, data: { title: "Kitten Image 1", image: "https://images.unsplash.com/photo-1595433707802-6b2626ef1c91", }, contents: {result: []}, isChecked: false, }, { id: 71002, data: { title: "Kitten Image 2", image: "https://images.unsplash.com/photo-1591871937573-74dbba515c4c", }, contents: {result: []}, isChecked: false, }, { id: 71003, data: { title: "Kitten Image 3", image: "https://images.unsplash.com/photo-1593288942460-e321b92a6cde", }, contents: {result: []}, isChecked: false, }, ], debugLogs: true, }; var ls = new LabelStudio("label-studio", lsfConfig); // ls.on("storageInitialized", (store) => { // ls.on("selectAnnotation", (next) => { // if (next.type === 'annotation') { // store.setHistory(annotationHistory) // } // }) // ls.on("updateAnnotation", (_, annotation) => { // console.log(annotation.serializeAnnotation()); // }) // ls.on("regionFinishedDrawing", (region, list) => { // console.log("finish drawing", {region, list}) // }) // }) ls.on("labelStudioLoad", (LS) => { // Perform an action when Label Studio is loaded const c = LS.annotationStore.addAnnotation({ userGenerate: true, }); LS.annotationStore.selectAnnotation(c.id); }); ls.on("submitAnnotation", (LS, annotation) => { // Retrieve an annotation in JSON format const annotationData = annotation.serializeAnnotation(); console.log('LS Submit: ', annotationData); }); ls.on("updateAnnotation", (LS, annotation) => { // Retrieve an annotation in JSON format const annotationData = annotation.serializeAnnotation(); console.log('LS Update: ', annotationData); }) ls.on("submitDraft", (LS, annotation) => { // Retrieve an annotation in JSON format const annotationData = annotation.serializeAnnotation(); console.log('LS Draft Saved: ', annotationData); }) ls.on("onEntityChange", (LS, annotation) => { const annotationData = annotation.serializeAnnotation(); console.log("onEntityChange: ", annotationData); }) }); </script> </body> </html>