-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathtest.html
82 lines (71 loc) · 2.11 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!-- TODO
- Can use my Component Hero architecture
- Add all LS callbacks as events
- Create an example event handler to capture the event data
- Provide a few annotation examples out-of-the-box
-->
<html>
<head>
<!-- Include Label Studio stylesheet -->
<link href="https://unpkg.com/label-studio/build/static/css/main.css" rel="stylesheet">
<!-- <link href="https://unpkg.com/label-studio@1.0.1/build/static/css/main.css" rel="stylesheet"> -->
</head>
<body>
<!-- Create the Label Studio container -->
<div id="label-studio"></div>
</body>
<!-- Include the Label Studio library -->
<script src="https://unpkg.com/label-studio/build/static/js/main.js"></script>
<!-- <script src="https://unpkg.com/label-studio@1.0.1/build/static/js/main.js"></script> -->
<!-- Initialize Label Studio -->
<script>
var labelStudio = new LabelStudio('label-studio', {
config: `
<View>
<Image name="img" value="$image"></Image>
<RectangleLabels name="tag" toName="img">
<Label value="Hello"></Label>
<Label value="World"></Label>
</RectangleLabels>
</View>
`,
interfaces: [
"panel",
"update",
"controls",
"side-column",
"annotations:menu",
"annotations:add-new",
"annotations:delete",
"predictions:menu"
],
user: {
pk: 1,
firstName: "James",
lastName: "Dean"
},
task: {
annotations: [],
predictions: [],
id: 1,
data: {
image: "https://htx-misc.s3.amazonaws.com/opensource/label-studio/examples/images/nick-owuor-astro-nic-visuals-wDifg5xc9Z4-unsplash.jpg"
}
},
onLabelStudioLoad: function(LS) {
var c = LS.annotationStore.addAnnotation({
userGenerate: true
});
LS.annotationStore.selectAnnotation(c.id);
},
onSubmitAnnotation: function(LS, annotation) {
// retrive an annotation
console.log(annotation.serializeAnnotation())
},
onUpdateAnnotation: function(LS, annotation) {
// retrive an annotation
console.log(annotation.serializeAnnotation())
}
});
</script>
</html>