index.html 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <link rel="shortcut icon" href="./public/favicon.ico" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  7. <!--
  8. Notice the use of %PUBLIC_URL% in the tags above.
  9. It will be replaced with the URL of the `public` folder during the build.
  10. Only files inside the `public` folder can be referenced from the HTML.
  11. Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
  12. work correctly both with client-side routing and a non-root public URL.
  13. Learn how to configure a non-root public URL by running `npm run build`.
  14. I think according to new design we should record not only update of result in annotation but review rejection/acceptance too, because in current way we can't show action range in the history, only result updating.
  15. In current functionality we create history record if we pass a result field. It doesn't let make a comment on review. Because we decided to relate comments to history.
  16. -->
  17. <link rel="stylesheet" href="./public/styles/main.css">
  18. <script>
  19. // window.APP_SETTINGS = {
  20. // feature_flags: {},
  21. // feature_flags_default_value: true,
  22. // }
  23. </script>
  24. <title>LSF</title>
  25. </head>
  26. <body>
  27. <noscript>
  28. You need to enable JavaScript to run this app.
  29. </noscript>
  30. <div id="header">
  31. <a id="logo" href="/">
  32. <img src="./public/images/ls_logo.svg" alt="label studio logo">
  33. </a>
  34. <ul id="nav">
  35. <li><a href="https://labelstud.io/guide">Docs</a></li>
  36. <li><a class="github-button" href="https://github.com/HumanSignal/label-studio"
  37. data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star humansignal/label-studio on GitHub"><img style="width:25px;height:25px;" src="./public/images/GitHub-Mark-64px.png" height="25" /></a></li>
  38. </ul>
  39. </div>
  40. <div id="ls-container">
  41. <div id="label-studio"></div>
  42. </div>
  43. <footer class="footer">
  44. Made with <img style="height:16px; width:auto; display: inline-block;" src="./public/images/3nowhite.svg" height="16" /> by <a target="_blank" style="line-height: 24px;" href="https://heartex.net">Heartex</a> in San Francisco
  45. </footer>
  46. <script>
  47. (function (d, o) {
  48. d.domReady = function (n, a) {
  49. o.addEventListener && o.addEventListener("DOMContentLoaded", function e(t) {
  50. o.removeEventListener("DOMContentLoaded", e), n.call(a || d, t)
  51. }) || o.attachEvent && o.attachEvent("onreadystatechange", function e(t) {
  52. "complete" === o.readyState && (o.detachEvent("onreadystatechange", e), n.call(a || d, t))
  53. })
  54. }
  55. })(window, document);
  56. </script>
  57. <style>
  58. body {
  59. height: 100vh;
  60. }
  61. #label-studio {
  62. height: calc(100vh - 88px);
  63. }
  64. #webpack-dev-server-client-overlay {
  65. display: none !important;
  66. visibility: hidden !important;
  67. pointer-events: none !important;
  68. }
  69. </style>
  70. <script>
  71. domReady(function () {
  72. if (window.DISABLE_DEFAULT_LSF_INIT) {
  73. console.log("Default initialization prevented")
  74. return false;
  75. }
  76. const annotationHistory = [
  77. //{"id":14,"created_by":1,"created_at":"2021-05-26T13:03:36.267438Z","action_type": "accepted","result":null,"annotation":24,"fixed_annotation_history":null,"previous_annotation_history":33,"previous_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"}]},
  78. //{"id":15,"created_by":1,"created_at":"2021-05-26T13:03:36.267438Z","action_type": "updated","result":null,"annotation":24,"fixed_annotation_history":null,"previous_annotation_history":33,"previous_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"}]},
  79. //{"id":16,"created_by":1,"created_at":"2021-05-26T13:03:36.267438Z","action_type": "rejected","result":null,"annotation":24,"fixed_annotation_history":null,"previous_annotation_history":33,"previous_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"}]},
  80. {"id":16,"comment": "I think according to new design we should record not only update of result in annotation but review rejection/acceptance too, because in current way we can't show action range in the history, only result updating.\n\nIn current functionality we create history record if we pass a result field. It doesn't let make a comment on review. Because we decided to relate comments to history.", "created_by":1,"created_at":"2021-05-26T13:03:36.267438Z","action_type": "fixed_and_accepted","result":null,"annotation":24,"fixed_annotation_history":null,"previous_annotation_history":33,"previous_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"}]},
  81. //{"id":17,"created_by":1,"action_type": "draft-created","created_at":"2021-05-26T13:03:43.335198Z","accepted":true,"result":null,"annotation":24,"fixed_annotation_history":34,"previous_annotation_history":33,"previous_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"}],"fixed_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"},{"id":"36kM4Zy2Y5","type":"labels","value":{"end":256,"text":"o do and he couldn t do","start":233,"labels":["PER"]},"to_name":"text","from_name":"label"}]},
  82. //{"id":18,"created_by":1,"action_type": "updated","created_at":"2021-05-26T13:03:43.335198Z","accepted":true,"result":null,"annotation":24,"fixed_annotation_history":34,"previous_annotation_history":33,"previous_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"}],"fixed_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"},{"id":"36kM4Zy2Y5","type":"labels","value":{"end":256,"text":"o do and he couldn t do","start":233,"labels":["PER"]},"to_name":"text","from_name":"label"}]},
  83. //{"id":19,"created_by":1,"action_type": "submitted", "created_at":"2021-05-26T13:03:49.330745Z","accepted":true,"result":null,"annotation":24,"fixed_annotation_history":35,"previous_annotation_history":34,"previous_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"},{"id":"36kM4Zy2Y5","type":"labels","value":{"end":256,"text":"o do and he couldn t do","start":233,"labels":["PER"]},"to_name":"text","from_name":"label"}],"fixed_annotation_history_result":[{"id":"XsW_x1hflv","type":"labels","value":{"end":838,"text":"Media, a Happy and Healthy New Year. 2018 will be a great year for America! Donald J. Trump (@realDonaldTrump) December 31, 2017Trump s tweet went down about as we","start":674,"labels":["LOC"]},"to_name":"text","from_name":"label"},{"id":"FCuvjfSXNs","type":"labels","value":{"end":1662,"text":" Sandoval (@AlanSandoval13) December 31, 2017Who uses the word Haters in a New Years wish?? Marlene (@marlene399) December 31, 2017You can t just say happy ","start":1505,"labels":["MISC"]},"to_name":"text","from_name":"label"},{"id":"36kM4Zy2Y5","type":"labels","value":{"end":256,"text":"o do and he couldn t do","start":233,"labels":["PER"]},"to_name":"text","from_name":"label"},{"id":"ALbgPwBdmj","type":"labels","value":{"end":2215,"text":"ale8) December 31, 2017Tr","start":2190,"labels":["MISC"]},"to_name":"text","from_name":"label"}]},
  84. {"id":19,"created_by":1,"action_type": "submitted", "created_at":"2021-05-26T13:03:49.330745Z","accepted":true,"result":null,"annotation":24,"fixed_annotation_history":35,"previous_annotation_history":34,"result":[{ "original_width": 2242, "original_height": 2802, "image_rotation": 0, "value": { "x": 22.038567493112954, "y": 44.27312775330397, "width": 30.57851239669421, "height": 24.008810572687224, "rotation": 0 }, "id": "EPcQbFzM5K", "from_name": "bbox", "to_name": "image", "type": "rectangle", "origin": "manual" }, { "original_width": 2242, "original_height": 2802, "image_rotation": 0, "value": { "x": 22.038567493112954, "y": 44.27312775330397, "width": 30.57851239669421, "height": 24.008810572687224, "rotation": 0, "labels": ["Handwriting"]}, "id": "EPcQbFzM5K", "from_name": "label", "to_name": "image", "type": "labels", "origin": "manual"},{"original_width": 2242, "original_height": 2802, "image_rotation": 0, "value": { "x": 22.038567493112954, "y": 44.27312775330397, "width": 30.57851239669421, "height": 24.008810572687224, "rotation": 0, "text": ["hello world"]}, "id": "EPcQbFzM5K", "from_name": "transcription", "to_name": "image", "type": "textarea", "origin": "manual"}]},
  85. ]
  86. const lsfConfig = {
  87. description: "Description",
  88. interfaces: [
  89. "panel",
  90. "update",
  91. "submit",
  92. "skip",
  93. "controls",
  94. //"review",
  95. "infobar",
  96. "topbar",
  97. "instruction",
  98. "side-column",
  99. "ground-truth",
  100. "annotations:tabs",
  101. "annotations:menu",
  102. "annotations:current",
  103. "annotations:add-new",
  104. "annotations:delete",
  105. 'annotations:view-all',
  106. "predictions:tabs",
  107. "predictions:menu",
  108. "auto-annotation",
  109. "edit-history",
  110. //"topbar:prevnext",
  111. ],
  112. user: {
  113. "id": 1,
  114. "first_name": "Nick",
  115. "last_name": "Skriabin",
  116. "username": "nick",
  117. "email": "nick@heartex.ai",
  118. "avatar": null,
  119. "initials": "ni",
  120. },
  121. users: [
  122. {
  123. "id": 1,
  124. "first_name": "Nick",
  125. "last_name": "Skriabin",
  126. "username": "nick",
  127. "email": "nick@heartex.ai",
  128. "avatar": null,
  129. "initials": "ni",
  130. }
  131. ],
  132. task: {
  133. annotations: [],
  134. predictions: [],
  135. id: 1,
  136. data: {
  137. image: "https://htx-pub.s3.us-east-1.amazonaws.com/examples/images/nick-owuor-astro-nic-visuals-wDifg5xc9Z4-unsplash.jpg"
  138. }
  139. },
  140. history: annotationHistory,
  141. };
  142. var ls = new LabelStudio("label-studio", lsfConfig);
  143. ls.on("storageInitialized", (store) => {
  144. ls.on("selectAnnotation", (next) => {
  145. if (next.type === 'annotation') {
  146. store.setHistory(annotationHistory)
  147. }
  148. })
  149. ls.on("updateAnnotation", (_, annotation) => {
  150. console.log(annotation.serializeAnnotation());
  151. })
  152. ls.on("regionFinishedDrawing", (region, list) => {
  153. console.log("finish drawing", {region, list})
  154. })
  155. })
  156. });
  157. </script>
  158. </body>
  159. </html>