lightly-studio 0.3.3__py3-none-any.whl → 0.4.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of lightly-studio might be problematic. Click here for more details.

Files changed (137) hide show
  1. lightly_studio/api/app.py +2 -0
  2. lightly_studio/api/features.py +3 -5
  3. lightly_studio/api/routes/api/caption.py +30 -0
  4. lightly_studio/api/routes/api/dataset_tag.py +10 -0
  5. lightly_studio/api/routes/api/embeddings2d.py +42 -39
  6. lightly_studio/api/routes/api/metadata.py +57 -1
  7. lightly_studio/core/add_samples.py +138 -0
  8. lightly_studio/core/dataset.py +232 -18
  9. lightly_studio/core/dataset_query/__init__.py +14 -0
  10. lightly_studio/core/sample.py +33 -1
  11. lightly_studio/dataset/loader.py +2 -8
  12. lightly_studio/db_manager.py +14 -6
  13. lightly_studio/dist_lightly_studio_view_app/_app/env.js +1 -1
  14. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/0.CN4hnTks.css +1 -0
  15. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/2.CkOblLn7.css +1 -0
  16. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/Samples.C0_eo9eP.css +1 -0
  17. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/{useFeatureFlags.CV-KWLNP.css → _layout.CefECEWA.css} +1 -1
  18. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/_layout.kFFGI0zL.css +1 -0
  19. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/transform.sLzR40om.css +1 -0
  20. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/{6t3IJ0vQ.js → BOmrKuMn.js} +1 -1
  21. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/{Cs1XmhiF.js → BPpOWbDa.js} +1 -1
  22. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BaFFwDFr.js +1 -0
  23. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BiGQqqJP.js +1 -0
  24. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BrNKoXwc.js +20 -0
  25. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BsaJCCG_.js +96 -0
  26. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BtXGzlpP.js +20 -0
  27. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/C1FmrZbK.js +1 -0
  28. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/C3xJX0nD.js +1 -0
  29. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CANX9QXL.js +1 -0
  30. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CAPx0Bfm.js +1 -0
  31. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CP9M7pei.js +39 -0
  32. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CWuDkrMZ.js +436 -0
  33. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/ChlxSwqI.js +1 -0
  34. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/Cj4nZbtb.js +1 -0
  35. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/ClzkJBWk.js +1 -0
  36. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CpbA3HU7.js +2 -0
  37. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D8ZGoCPm.js +3 -0
  38. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DMJzr1NB.js +1 -0
  39. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/{BdfTHw61.js → DNJnBfHs.js} +1 -1
  40. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/{keKYsoph.js → DUtlYNuP.js} +1 -1
  41. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DVxjPOJB.js +1 -0
  42. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DmGM9V9Q.js +1 -0
  43. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DoEId1MK.js +1 -0
  44. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DthpwYR_.js +2 -0
  45. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DyIcJj6J.js +1 -0
  46. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/SiegjVo0.js +1 -0
  47. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/{BfHVnyNT.js → WEyXQRi6.js} +1 -1
  48. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/gBp1tBnA.js +1 -0
  49. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/xQhUoIl9.js +1 -0
  50. lightly_studio/dist_lightly_studio_view_app/_app/immutable/entry/app.Y-sSoz5q.js +2 -0
  51. lightly_studio/dist_lightly_studio_view_app/_app/immutable/entry/start.CvxVp0Cu.js +1 -0
  52. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/0.0Fm6E-5B.js +4 -0
  53. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/1.DB-0vkHb.js +1 -0
  54. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/10.vaUePh5k.js +1 -0
  55. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/11.7i7ljNVT.js +1 -0
  56. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/13.9qy3WtZv.js +1 -0
  57. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/{2.C8HLK8mj.js → 2.Drwwdm7A.js} +267 -111
  58. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/{3.CLvg3QcJ.js → 3.D3X_-Wan.js} +1 -1
  59. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/{4.BQhDtXUI.js → 4.C9TqY3tA.js} +1 -1
  60. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/5.iRw6HCWX.js +39 -0
  61. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/{6.uBV1Lhat.js → 6.fqfYR7dB.js} +1 -1
  62. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/7.C7gMM-gk.js +1 -0
  63. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/8.C4v1w-oS.js +20 -0
  64. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/9.DbHcSiMn.js +1 -0
  65. lightly_studio/dist_lightly_studio_view_app/_app/version.json +1 -1
  66. lightly_studio/dist_lightly_studio_view_app/index.html +15 -14
  67. lightly_studio/examples/example.py +4 -0
  68. lightly_studio/examples/example_coco.py +4 -0
  69. lightly_studio/examples/example_coco_caption.py +24 -0
  70. lightly_studio/examples/example_metadata.py +4 -1
  71. lightly_studio/examples/example_selection.py +4 -0
  72. lightly_studio/examples/example_split_work.py +4 -0
  73. lightly_studio/examples/example_yolo.py +4 -0
  74. lightly_studio/export/export_dataset.py +11 -3
  75. lightly_studio/metadata/compute_typicality.py +1 -1
  76. lightly_studio/models/caption.py +74 -0
  77. lightly_studio/models/dataset.py +1 -2
  78. lightly_studio/models/metadata.py +1 -1
  79. lightly_studio/models/sample.py +9 -2
  80. lightly_studio/models/settings.py +5 -0
  81. lightly_studio/resolvers/caption_resolver.py +80 -0
  82. lightly_studio/resolvers/dataset_resolver.py +6 -11
  83. lightly_studio/resolvers/metadata_resolver/__init__.py +2 -2
  84. lightly_studio/resolvers/metadata_resolver/sample/__init__.py +3 -3
  85. lightly_studio/resolvers/metadata_resolver/sample/bulk_update_metadata.py +46 -0
  86. lightly_studio/resolvers/sample_resolver.py +1 -0
  87. lightly_studio/resolvers/samples_filter.py +18 -10
  88. lightly_studio/resolvers/settings_resolver.py +3 -0
  89. lightly_studio/resolvers/twodim_embedding_resolver.py +29 -0
  90. lightly_studio/selection/__init__.py +1 -0
  91. lightly_studio/selection/mundig.py +41 -0
  92. lightly_studio/type_definitions.py +2 -0
  93. lightly_studio-0.4.0.dist-info/METADATA +78 -0
  94. {lightly_studio-0.3.3.dist-info → lightly_studio-0.4.0.dist-info}/RECORD +96 -88
  95. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/0.CA_CXIBb.css +0 -1
  96. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/_layout.DS78jgNY.css +0 -1
  97. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/index.BVs_sZj9.css +0 -1
  98. lightly_studio/dist_lightly_studio_view_app/_app/immutable/assets/transform.D487hwJk.css +0 -1
  99. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/8NsknIT2.js +0 -1
  100. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BND_-4Kp.js +0 -1
  101. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BjkP1AHA.js +0 -1
  102. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BuuNVL9G.js +0 -1
  103. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/BzKGpnl4.js +0 -1
  104. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CCx7Ho51.js +0 -1
  105. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CH6P3X75.js +0 -1
  106. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CR2upx_Q.js +0 -4
  107. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CWPZrTTJ.js +0 -1
  108. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CwPowJfP.js +0 -1
  109. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/CxFKfZ9T.js +0 -1
  110. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/Cxevwdid.js +0 -1
  111. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D4whDBUi.js +0 -1
  112. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/D6r9vr07.js +0 -1
  113. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DA6bFLPR.js +0 -1
  114. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DEgUu98i.js +0 -3
  115. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DGTPl6Gk.js +0 -1
  116. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DKGxBSlK.js +0 -1
  117. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DQXoLcsF.js +0 -1
  118. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DQe_kdRt.js +0 -92
  119. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/DcY4jgG3.js +0 -1
  120. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/H7C68rOM.js +0 -1
  121. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/RmD8FzRo.js +0 -1
  122. lightly_studio/dist_lightly_studio_view_app/_app/immutable/chunks/V-MnMC1X.js +0 -1
  123. lightly_studio/dist_lightly_studio_view_app/_app/immutable/entry/app.BVr6DYqP.js +0 -2
  124. lightly_studio/dist_lightly_studio_view_app/_app/immutable/entry/start.u7zsVvqp.js +0 -1
  125. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/0.Da2agmdd.js +0 -1
  126. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/1.B11tVRJV.js +0 -1
  127. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/10.l30Zud4h.js +0 -1
  128. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/12.CgKPGcAP.js +0 -1
  129. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/5.-6XqWX5G.js +0 -1
  130. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/7.BXsgoQZh.js +0 -1
  131. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/8.BkbcnUs8.js +0 -1
  132. lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/9.Bkrv-Vww.js +0 -1
  133. lightly_studio/resolvers/metadata_resolver/sample/bulk_set_metadata.py +0 -48
  134. lightly_studio/selection/README.md +0 -6
  135. lightly_studio-0.3.3.dist-info/METADATA +0 -814
  136. /lightly_studio/dist_lightly_studio_view_app/_app/immutable/nodes/{11.CWG1ehzT.js → 12.CWG1ehzT.js} +0 -0
  137. {lightly_studio-0.3.3.dist-info → lightly_studio-0.4.0.dist-info}/WHEEL +0 -0
@@ -1 +1 @@
1
- import{u as a}from"../chunks/CCx7Ho51.js";import{L as d}from"../chunks/Cxevwdid.js";const s=async({parent:t,params:{dataset_id:e}})=>{const{globalStorage:o}=await t(),{tagsSelected:n}=a({dataset_id:e,kind:["annotation"]});return{annotationsSelectedTagsIds:n,annotationsSelectedAnnotationLabelsIds:o.selectedAnnotationFilterIds}},r=Object.freeze(Object.defineProperty({__proto__:null,load:s},Symbol.toStringTag,{value:"Module"}));export{d as component,r as universal};
1
+ import{u as a}from"../chunks/DMJzr1NB.js";import{L as d}from"../chunks/DVxjPOJB.js";const s=async({parent:t,params:{dataset_id:e}})=>{const{globalStorage:o}=await t(),{tagsSelected:n}=a({dataset_id:e,kind:["annotation"]});return{annotationsSelectedTagsIds:n,annotationsSelectedAnnotationLabelsIds:o.selectedAnnotationFilterIds}},r=Object.freeze(Object.defineProperty({__proto__:null,load:s},Symbol.toStringTag,{value:"Module"}));export{d as component,r as universal};
@@ -1 +1 @@
1
- import{u as a}from"../chunks/8NsknIT2.js";import{u as l}from"../chunks/CCx7Ho51.js";import{u as m}from"../chunks/6t3IJ0vQ.js";import{L as b}from"../chunks/Cxevwdid.js";const r=async({params:{dataset_id:e}})=>{const{selectedAnnotationFilterIds:s,textEmbedding:o}=m(),{tagsSelected:t}=l({dataset_id:e,kind:["sample"]}),{dimensionsValues:n}=a();return{samplesSelectedTagsIds:t,samplesDimensions:n,samplesTextEmbedding:o,samplesSelectedAnnotationLabelsIds:s}},c=Object.freeze(Object.defineProperty({__proto__:null,load:r},Symbol.toStringTag,{value:"Module"}));export{b as component,c as universal};
1
+ import{u as a}from"../chunks/ClzkJBWk.js";import{u as l}from"../chunks/DMJzr1NB.js";import{u as m}from"../chunks/BOmrKuMn.js";import{L as b}from"../chunks/DVxjPOJB.js";const r=async({params:{dataset_id:e}})=>{const{selectedAnnotationFilterIds:s,textEmbedding:o}=m(),{tagsSelected:t}=l({dataset_id:e,kind:["sample"]}),{dimensionsValues:n}=a();return{samplesSelectedTagsIds:t,samplesDimensions:n,samplesTextEmbedding:o,samplesSelectedAnnotationLabelsIds:s}},c=Object.freeze(Object.defineProperty({__proto__:null,load:r},Symbol.toStringTag,{value:"Module"}));export{b as component,c as universal};
@@ -0,0 +1,39 @@
1
+ import"../chunks/CWj6FrbW.js";import{p as gt,f as _,n as le,a as ht,am as te,g as t,b as r,s as h,c as I,r as A,t as mt,m as ft,u as He,Z as s,al as $,ab as ee,$ as ae}from"../chunks/C3xJX0nD.js";import{c as Q,a as c,f as tt,t as ne,d as $t}from"../chunks/CAPx0Bfm.js";import{s as It}from"../chunks/DoEId1MK.js";import{i as Y,s as G,a as Nt}from"../chunks/DmGM9V9Q.js";import{p as yt}from"../chunks/DUtlYNuP.js";import{I as ie,o as Fe,p as ze,q as Ne,r as Xe,t as At,v as Ye,w as Ze,_ as Ue,x as Ke,y as Oe,z as je,C as Ge,B as Ve,D as We,R as qe,n as Je,E as Qe,F as ta}from"../chunks/CWuDkrMZ.js";import{u as de}from"../chunks/BOmrKuMn.js";import{u as ce,k as ea,t as ut,c as H,e as aa,b as na}from"../chunks/DthpwYR_.js";import"../chunks/ClzkJBWk.js";import"../chunks/BaFFwDFr.js";import"../chunks/69_IOA4Y.js";import{a as oa,g as sa}from"../chunks/D8ZGoCPm.js";import"../chunks/gBp1tBnA.js";import{e as oe}from"../chunks/SiegjVo0.js";import{s as ue,r as me,p as ra,b as se}from"../chunks/xQhUoIl9.js";import{S as la}from"../chunks/BiGQqqJP.js";import{r as St}from"../chunks/ChlxSwqI.js";import{s as re}from"../chunks/CpbA3HU7.js";import{B as ia,a as da,b as wt,c as Ft,H as ca,d as zt,D as ua,e as ma,u as ge,Z as ga,g as ha}from"../chunks/BsaJCCG_.js";import{a as va,b as fa,d as pa,e as _a}from"../chunks/DyIcJj6J.js";function ba(u,e){gt(e,!0);/**
2
+ * @license @lucide/svelte v0.482.0 - ISC
3
+ *
4
+ * ISC License
5
+ *
6
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
7
+ *
8
+ * Permission to use, copy, modify, and/or distribute this software for any
9
+ * purpose with or without fee is hereby granted, provided that the above
10
+ * copyright notice and this permission notice appear in all copies.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ *
20
+ */let m=me(e,["$$slots","$$events","$$legacy"]);const l=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4"}],["circle",{cx:"10",cy:"12",r:"2"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22"}]];ie(u,ue({name:"file-image"},()=>m,{get iconNode(){return l},children:(n,i)=>{var d=Q(),p=_(d);It(p,()=>e.children??le),c(n,d)},$$slots:{default:!0}})),ht()}function xa(u,e){gt(e,!0);/**
21
+ * @license @lucide/svelte v0.482.0 - ISC
22
+ *
23
+ * ISC License
24
+ *
25
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
26
+ *
27
+ * Permission to use, copy, modify, and/or distribute this software for any
28
+ * purpose with or without fee is hereby granted, provided that the above
29
+ * copyright notice and this permission notice appear in all copies.
30
+ *
31
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
32
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
33
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
34
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
35
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
36
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
37
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
38
+ *
39
+ */let m=me(e,["$$slots","$$events","$$legacy"]);const l=[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18"}],["circle",{cx:"12",cy:"8",r:"2"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2"}]];ie(u,ue({name:"images"},()=>m,{get iconNode(){return l},children:(n,i)=>{var d=Q(),p=_(d);It(p,()=>e.children??le),c(n,d)},$$slots:{default:!0}})),ht()}var wa=tt('<!> <span class="hidden sm:inline">Home</span>',1),ya=tt('<!> <span class="max-w-[150px] truncate"> </span>',1),Sa=tt('<!> <span class="hidden sm:inline">Samples</span>',1),$a=tt('<!> <span class="max-w-[200px] truncate"><!></span>',1),Ia=tt("<!> <!> <!> <!> <!> <!> <!>",1);function Aa(u,e){gt(e,!0);const m=()=>G(i,"$samplesTotalCount",l),[l,n]=Nt(),{samplesTotalCount:i}=de();ia(u,{class:"mb-2","data-testid":"sample-details-breadcrumb",children:(d,p)=>{da(d,{children:(et,ot)=>{var F=Ia(),w=_(F);wt(w,{children:(P,V)=>{{let g=r(()=>St.toHome());Ft(P,{get href(){return t(g)},class:"flex items-center gap-2",children:(M,T)=>{var b=wa(),y=_(b);ca(y,{class:"h-4 w-4"}),te(2),c(M,b)},$$slots:{default:!0}})}},$$slots:{default:!0}});var z=h(w,2);zt(z,{});var C=h(z,2);wt(C,{children:(P,V)=>{{let g=r(()=>St.toSamples(e.dataset.dataset_id));Ft(P,{get href(){return t(g)},class:"flex items-center gap-2",children:(M,T)=>{var b=ya(),y=_(b);ua(y,{class:"h-4 w-4"});var B=h(y,2),at=I(B,!0);A(B),mt(()=>re(at,e.dataset.name)),c(M,b)},$$slots:{default:!0}})}},$$slots:{default:!0}});var Z=h(C,2);zt(Z,{});var N=h(Z,2);wt(N,{children:(P,V)=>{{let g=r(()=>St.toSamples(e.dataset.dataset_id));Ft(P,{get href(){return t(g)},class:"flex items-center gap-2",children:(M,T)=>{var b=Sa(),y=_(b);xa(y,{class:"h-4 w-4"}),te(2),c(M,b)},$$slots:{default:!0}})}},$$slots:{default:!0}});var st=h(N,2);zt(st,{});var rt=h(st,2);wt(rt,{children:(P,V)=>{ma(P,{class:"flex items-center gap-2",children:(g,M)=>{var T=$a(),b=_(T);ba(b,{class:"h-4 w-4"});var y=h(b,2),B=I(y);{var at=W=>{var lt=ne();mt(()=>re(lt,`Sample ${e.sampleIndex+1} of ${m()??""}`)),c(W,lt)},Pt=W=>{var lt=ne("Sample");c(W,lt)};Y(B,W=>{e.sampleIndex!==void 0?W(at):W(Pt,!1)})}A(y),c(g,T)},$$slots:{default:!0}})},$$slots:{default:!0}}),c(et,F)},$$slots:{default:!0}})},$$slots:{default:!0}}),ht(),n()}function Pa(u,e){gt(e,!0);const m=()=>G(t(F),"$annotationResp",i),l=()=>G(t(Z),"$sample",i),n=()=>G(et,"$showAnnotationTextLabelsStore",i),[i,d]=Nt(),p=ra(e,"isResizable",3,!1),{showAnnotationTextLabelsStore:et}=ce(),ot=r(()=>Xe({datasetId:e.datasetId,annotationId:e.annotationId})),F=r(()=>t(ot).annotation),w=r(()=>t(ot).updateAnnotation);let z=r(()=>m().data);const C=r(()=>ge({sampleId:e.sampleId,datasetId:e.datasetId})),Z=r(()=>t(C).sample);let N=r(()=>m().data?Fe(m().data):void 0);const st=g=>{(async()=>{try{await t(w)({annotation_id:e.annotationId,dataset_id:e.datasetId,bounding_box:g})}catch(T){console.error("Failed to update annotation:",T.message)}})()};var rt=Q(),P=_(rt);{var V=g=>{var M=Q(),T=_(M);ea(T,()=>t(N),b=>{ze(b,{get groupId(){return t(z).annotation_id},get onSelect(){return e.toggleAnnotationSelection},get box(){return t(N)},get isSelected(){return e.isSelected},children:(y,B)=>{{let at=r(()=>({x:0,y:0,width:l().data.width,height:l().data.height}));Ne(y,{get annotation(){return t(z)},get showLabel(){return n()},get imageWidth(){return l().data.width},get constraintBox(){return t(at)},get isResizable(){return p()},onBoundingBoxChanged:st})}},$$slots:{default:!0}})}),c(g,M)};Y(P,g=>{t(z)&&l().data&&t(N)&&g(V)})}c(u,rt),ht(),d()}const Ma=({datasetId:u})=>{const e=At(va());return e.subscribe(()=>{}),{createAnnotation:l=>new Promise((n,i)=>{ft(e).mutate({path:{dataset_id:u},body:l},{onSuccess:d=>{n(d)},onError:d=>{i(d)}})})}},Ba=()=>{const u=At(fa());return u.subscribe(()=>{}),{createLabel:m=>new Promise((l,n)=>{ft(u).mutate({body:m},{onSuccess:i=>{l(i)},onError:i=>{n(i)}})})}},ka=({datasetId:u})=>{const e=At(pa());return e.subscribe(()=>{}),{deleteAnnotation:l=>new Promise((n,i)=>{ft(e).mutate({path:{dataset_id:u,annotation_id:l}},{onSuccess:()=>{n()},onError:d=>{i(d)}})})}},Ea=({datasetId:u})=>{const e=At(_a());return e.subscribe(()=>{}),{removeTagFromSample:(l,n)=>new Promise((i,d)=>{ft(e).mutate({path:{dataset_id:u,sample_id:l,tag_id:n}},{onSuccess:()=>i(),onError:p=>d(p)})})}};var Ra=$t('<line x1="0" stroke-width="1" vector-effect="non-scaling-stroke" stroke-dasharray="5,5" opacity="0.6"></line><line y1="0" vector-effect="non-scaling-stroke" stroke-width="1" stroke-dasharray="5,5" opacity="0.6"></line>',1),Ca=$t('<rect class="select-none" fill="transparent" role="button" style="outline: 0;cursor: crosshair;" tabindex="0"></rect>'),Ta=$t("<g><!><!><!></g><!>",1),Da=$t("<image></image><!>",1),La=tt('<div class="h-full w-full overflow-hidden"><div class="sample relative h-full w-full"><div class="absolute right-4 top-2 z-30"><!></div> <!> <!></div></div>'),Ha=tt('<div class="flex h-full w-full flex-col space-y-4"><div class="flex w-full items-center"><!></div> <!> <div class="flex min-h-0 flex-1 gap-4"><div class="flex-1"><!></div> <div class="relative w-[375px]"><!></div></div></div>');function Fa(u,e){gt(e,!0);const m=()=>G(T,"$labels",p),l=()=>G(y,"$isEditingMode",p),n=()=>G(t(V),"$sample",p),i=()=>G(ot,"$selectedSampleIds",p),d=()=>G(z,"$isHidden",p),[p,et]=Nt(),{selectedSampleIds:ot,toggleSampleSelection:F}=de(),w=e.dataset.dataset_id,{isHidden:z,handleKeyEvent:C}=Ye(),{settingsStore:Z}=ce(),{deleteAnnotation:N}=ka({datasetId:w}),{removeTagFromSample:st}=Ea({datasetId:w}),rt=()=>{sa(St.toSamples(w))},P=r(()=>ge({sampleId:e.sampleId,datasetId:w})),V=r(()=>t(P).sample),g=r(()=>t(P).refetch),{createAnnotation:M}=Ma({datasetId:w}),T=Ze(),{createLabel:b}=Ba(),{isEditingMode:y}=yt.data.globalStorage;let B=$(!1);const at=async({x:a,y:o,width:k,height:D,labelName:v})=>{if(!m().data)return;let E=m().data.find(x=>x.annotation_label_name===v);E||(E=await b({annotation_label_name:v}));try{const x=await M({sample_id:e.sampleId,annotation_type:"object_detection",x:Math.round(a),y:Math.round(o),width:Math.round(k),height:Math.round(D),annotation_label_id:E.annotation_label_id});return t(g)(),s(U,x.annotation_id,!0),ut.success("Annotation created successfully"),x}catch(x){ut.error("Failed to create annotation. Please try again."),console.error("Error creating annotation:",x);return}},Pt=a=>{switch(a.key){case ft(Z).key_go_back:rt();break;case" ":a.preventDefault(),a.stopPropagation(),console.log("space pressed in sample details"),l()?s(B,!0):F(e.sampleId);break}C(a)},W=a=>{a.key===" "&&s(B,!1),C(a)};let lt=r(()=>ha(e.sampleId)),U=$(void 0),Xt=$(void 0);oa(()=>{var a;s(U,void 0),s(Zt,void 0),(a=t(Xt))==null||a(),s(vt,!1),s(O,void 0)});const Yt=a=>{t(B)||(t(U)===a?s(U,void 0):s(U,a,!0))};let Zt=$(void 0),it=$(!1),S=$(null),q=$(null),K=$(null);const he=()=>{s(it,!1),s(S,null),s(K,null)};let vt=$(!1);const Ut=10,ve=()=>{if(!t(q))return;const a=Oe(t(q));let o=null;const k=je().on("start",D=>{if(!t(vt))return;s(it,!0);const v=t(q).getBoundingClientRect(),E=D.sourceEvent.clientX,x=D.sourceEvent.clientY,L=(E-v.left)/v.width*n().data.width,R=(x-v.top)/v.height*n().data.height;o={x:L,y:R},s(S,{x:L,y:R,width:0,height:0},!0),s(K,{x:L,y:R},!0)}).on("drag",D=>{if(!t(S)||!t(it)||!o)return;const v=t(q).getBoundingClientRect(),E=D.sourceEvent.clientX,x=D.sourceEvent.clientY;let L=(E-v.left)/v.width*n().data.width,R=(x-v.top)/v.height*n().data.height;const Et=n().data.width,Rt=n().data.height;L=Math.max(0,Math.min(L,Et)),R=Math.max(0,Math.min(R,Rt));const nt=Math.min(o.x,L),dt=Math.min(o.y,R),Ct=Math.abs(L-o.x),jt=Math.abs(R-o.y);s(S,{x:nt,y:dt,width:Ct,height:jt},!0),s(K,{x:L,y:R},!0)}).on("end",()=>{!t(S)||!t(it)||(t(S).width>Ut&&t(S).height>Ut&&t(O)&&at({x:t(S).x,y:t(S).y,width:t(S).width,height:t(S).height,labelName:t(O).label}),he(),o=null)});return a.call(k),a.on("mousemove",pe),()=>{k.on("start",null).on("drag",null).on("end",null)}},fe=a=>{if(!t(q)||t(it))return;const o=t(q).getBoundingClientRect(),k=a.clientX,D=a.clientY,v=(k-o.left)/o.width*n().data.width,E=(D-o.top)/o.height*n().data.height;s(K,{x:v,y:E},!0),a.stopPropagation(),a.preventDefault()},pe=Ue.throttle(fe,50);He(()=>{ve(),t(V).subscribe(a=>{if(a.isSuccess&&a.data){let o=Ke(a.data);s(Mt,o,!0)}else s(Mt,[],!0)})});let O=$(void 0),Mt=$(ee([])),pt=$(ee(new Set));const _e=a=>{const o=new Set(t(pt));o.has(a)?o.delete(a):o.add(a),s(pt,o,!0)},be=r(()=>t(Mt).filter(a=>!t(pt).has(a.annotation_id))),Bt=r(()=>t(O)?Qe(t(O).label,1).color:"blue"),xe=async a=>{if(!n().data)return;(async()=>{try{await N(a),ut.success("Annotation deleted successfully"),t(g)(),t(U)===a&&s(U,void 0)}catch(k){ut.error("Failed to delete annotation. Please try again."),console.error("Error deleting annotation:",k)}})()},we=async a=>{try{await st(e.sampleId,a),ut.success("Tag removed successfully"),t(g)()}catch(o){ut.error("Failed to remove tag. Please try again."),console.error("Error removing tag from sample:",o)}},ye=r(()=>t(B)?"grab":t(kt)?"crosshair":"auto"),Se=r(()=>l()&&!t(B)),kt=r(()=>t(vt)&&!t(B)&&t(O)!==void 0);let Kt=$(null);var Ot=Q();oe("keydown",ae,Pt),oe("keyup",ae,W);var $e=_(Ot);{var Ie=a=>{var o=Ha(),k=I(o),D=I(k);Aa(D,{get dataset(){return e.dataset},get sampleIndex(){return e.sampleIndex}}),A(k);var v=h(k,2);la(v,{class:"mb-4 bg-border-hard"});var E=h(v,2),x=I(E),L=I(x);Ge(L,{className:"h-full",children:(nt,dt)=>{Ve(nt,{className:"h-full",children:(Ct,jt)=>{var Tt=La(),Dt=I(Tt),Lt=I(Dt),Pe=I(Lt);{let J=r(()=>i().has(e.sampleId));We(Pe,{onSelect:()=>F(e.sampleId),get isSelected(){return t(J)}})}A(Lt);var Gt=h(Lt,2);{var Me=J=>{var ct=Q(),_t=_(ct);It(_t,()=>e.children),c(J,ct)};Y(Gt,J=>{e.children&&J(Me)})}var Be=h(Gt,2);ga(Be,{get width(){return n().data.width},get height(){return n().data.height},get cursor(){return t(ye)},get boundingBox(){return t(Zt)},registerResetFn:ct=>s(Xt,ct,!0),zoomableContent:ct=>{var _t=Da(),Vt=_(_t),ke=h(Vt);{var Ee=Ht=>{var Wt=Ta(),bt=_(Wt);let qt;var Jt=I(bt);aa(Jt,17,()=>t(be),f=>f.annotation_id,(f,X)=>{{let j=r(()=>t(U)===t(X).annotation_id);Pa(f,{get annotationId(){return t(X).annotation_id},get sampleId(){return e.sampleId},get datasetId(){return w},get isResizable(){return t(Se)},get isSelected(){return t(j)},toggleAnnotationSelection:Yt})}});var Qt=h(Jt);{var Re=f=>{qe(f,{get bbox(){return t(S)},get colorStroke(){return t(Bt)},colorFill:"rgba(0, 123, 255, 0.1)",style:"outline: 0;",opacity:.8,scale:1})};Y(Qt,f=>{t(S)&&t(it)&&t(O)&&f(Re)})}var Ce=h(Qt);{var Te=f=>{var X=Ra(),j=_(X),xt=h(j);mt(()=>{H(j,"y1",t(K).y),H(j,"x2",n().data.width),H(j,"y2",t(K).y),H(j,"stroke",t(Bt)),H(xt,"x1",t(K).x),H(xt,"x2",t(K).x),H(xt,"y2",n().data.height),H(xt,"stroke",t(Bt))}),c(f,X)};Y(Ce,f=>{t(K)&&t(kt)&&f(Te)})}A(bt);var De=h(bt);{var Le=f=>{var X=Ca();se(X,j=>s(q,j),()=>t(q)),mt(()=>{H(X,"width",n().data.width),H(X,"height",n().data.height)}),c(f,X)};Y(De,f=>{t(kt)&&f(Le)})}mt(f=>qt=na(bt,0,"",null,qt,f),[()=>({invisible:d()})]),c(Ht,Wt)};Y(ke,Ht=>{n().data&&Ht(Ee)})}mt(()=>H(Vt,"href",t(lt))),c(ct,_t)},$$slots:{zoomableContent:!0}}),A(Dt),se(Dt,J=>s(Kt,J),()=>t(Kt)),A(Tt),c(Ct,Tt)},$$slots:{default:!0}})},$$slots:{default:!0}}),A(x);var R=h(x,2),Et=I(R);{var Rt=nt=>{ta(nt,{get sample(){return n().data},get annotationsIdsToHide(){return t(pt)},get selectedAnnotationId(){return t(U)},onAnnotationClick:Yt,onToggleShowAnnotation:_e,onDeleteAnnotation:xe,onRemoveTag:we,get onUpdate(){return t(g)},get addAnnotationEnabled(){return t(vt)},set addAnnotationEnabled(dt){s(vt,dt,!0)},get addAnnotationLabel(){return t(O)},set addAnnotationLabel(dt){s(O,dt,!0)}})};Y(Et,nt=>{n().data&&nt(Rt)})}A(R),A(E),A(o),c(a,o)},Ae=a=>{Je(a,{})};Y($e,a=>{n().data?a(Ie):a(Ae,!1)})}c(u,Ot),ht(),et()}var za=tt('<div class="flex h-full w-full space-x-4 px-4 pb-4" data-testid="sample-details"><div class="h-full w-full space-y-6 rounded-[1vw] bg-card p-4"><!></div></div>');function ln(u,e){gt(e,!0);const m=r(()=>yt.params.sampleId),l=yt.data.dataset,n=r(()=>Number(yt.params.sampleIndex));var i=za(),d=I(i),p=I(d);Fa(p,{get sampleId(){return t(m)},get dataset(){return l},get sampleIndex(){return t(n)},children:(et,ot)=>{var F=Q(),w=_(F);{var z=C=>{var Z=Q(),N=_(Z);It(N,()=>e.children),c(C,Z)};Y(w,C=>{e.children&&C(z)})}c(et,F)},$$slots:{default:!0}}),A(d),A(i),c(u,i),ht()}export{ln as component};
@@ -1 +1 @@
1
- import{r as s}from"../chunks/H7C68rOM.js";import{r as d}from"../chunks/CxFKfZ9T.js";import{r as n}from"../chunks/B90CZVMX.js";const i=async()=>{const{data:t}=await d();if(!t||t.length===0)throw new Error("No datasets found");const e=t.toSorted((r,o)=>new Date(o.created_at||0).getTime()-new Date(r.created_at||0).getTime())[0],a=e==null?void 0:e.dataset_id;if(!a)throw new Error("No valid dataset ID found");n(307,s.toSamples(a))},m=Object.freeze(Object.defineProperty({__proto__:null,load:i},Symbol.toStringTag,{value:"Module"}));export{m as universal};
1
+ import{r as s}from"../chunks/ChlxSwqI.js";import{r as d}from"../chunks/BaFFwDFr.js";import{r as n}from"../chunks/B90CZVMX.js";const i=async()=>{const{data:t}=await d();if(!t||t.length===0)throw new Error("No datasets found");const e=t.toSorted((r,o)=>new Date(o.created_at||0).getTime()-new Date(r.created_at||0).getTime())[0],a=e==null?void 0:e.dataset_id;if(!a)throw new Error("No valid dataset ID found");n(307,s.toSamples(a))},m=Object.freeze(Object.defineProperty({__proto__:null,load:i},Symbol.toStringTag,{value:"Module"}));export{m as universal};
@@ -0,0 +1 @@
1
+ import"../chunks/CWj6FrbW.js";import{p as f,u as $,g as a,a as _,b as o}from"../chunks/C3xJX0nD.js";import{s as i,a as h}from"../chunks/DmGM9V9Q.js";import{A as S}from"../chunks/CWuDkrMZ.js";import{u as T}from"../chunks/BOmrKuMn.js";import"../chunks/DthpwYR_.js";import"../chunks/ClzkJBWk.js";import"../chunks/BaFFwDFr.js";import"../chunks/DUtlYNuP.js";import"../chunks/69_IOA4Y.js";import"../chunks/D8ZGoCPm.js";import{u as G}from"../chunks/DMJzr1NB.js";import"../chunks/gBp1tBnA.js";function q(n,t){f(t,!0);const p=()=>i(c,"$lastGridType",s),e=()=>i(d,"$sampleSize",s),[s,m]=h(),{datasetId:r,sampleSize:d,selectedAnnotationFilterIds:l}=t.data,{lastGridType:c}=T(),u=o(()=>G({dataset_id:r})),g=o(()=>a(u).clearTagsSelected);$(()=>{p()!=="annotations"&&a(g)()}),S(n,{get itemHeight(){return e().height},get itemWidth(){return e().width},get dataset_id(){return r},get selectedAnnotationFilterIds(){return l}}),_(),m()}export{q as component};
@@ -0,0 +1,20 @@
1
+ import{p as z,f as E,n as Xt,a as F,w as Et,m as pt,$ as ht,g as t,b as n,c as p,r as g,s as M,t as q,am as Ct,u as ta,al as Bt,Z as at}from"../chunks/C3xJX0nD.js";import{n as aa}from"../chunks/BaFFwDFr.js";import{u as It}from"../chunks/BOmrKuMn.js";import"../chunks/CWj6FrbW.js";import{c as Q,a as u,f as B,t as Dt,d as ea}from"../chunks/CAPx0Bfm.js";import{i as H,s as j,a as W}from"../chunks/DmGM9V9Q.js";import{e as bt}from"../chunks/SiegjVo0.js";import{c as ot,e as na,g as oa,u as sa,k as ia,b as ra,t as da}from"../chunks/DthpwYR_.js";import{g as nt,c as la,a as ca}from"../chunks/D8ZGoCPm.js";import{I as ua,w as va,r as st,G as ma,H as fa,J as ga,K as _a,o as xt,M as Rt,N as pa,C as Lt,B as jt,O as ha,n as Tt,v as ba,D as xa,q as Ia}from"../chunks/CWuDkrMZ.js";import"../chunks/ClzkJBWk.js";import{p as U}from"../chunks/DUtlYNuP.js";import"../chunks/69_IOA4Y.js";import{S as Aa}from"../chunks/BiGQqqJP.js";import"../chunks/gBp1tBnA.js";import{r as K}from"../chunks/ChlxSwqI.js";import{B as $a,a as wa,b as et,c as gt,H as Sa,d as _t,D as ya,e as Ma,Z as ka,g as Pa,u as Na}from"../chunks/BsaJCCG_.js";import{S as Ca}from"../chunks/DNJnBfHs.js";import{s as V}from"../chunks/CpbA3HU7.js";import{C as Ba}from"../chunks/BtXGzlpP.js";import{s as Da}from"../chunks/DoEId1MK.js";import{s as Ra,r as Ea}from"../chunks/xQhUoIl9.js";function La(l,a){z(a,!0);/**
2
+ * @license @lucide/svelte v0.482.0 - ISC
3
+ *
4
+ * ISC License
5
+ *
6
+ * Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
7
+ *
8
+ * Permission to use, copy, modify, and/or distribute this software for any
9
+ * purpose with or without fee is hereby granted, provided that the above
10
+ * copyright notice and this permission notice appear in all copies.
11
+ *
12
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19
+ *
20
+ */let e=Ea(a,["$$slots","$$events","$$legacy"]);const v=[["path",{d:"M5 3a2 2 0 0 0-2 2"}],["path",{d:"M19 3a2 2 0 0 1 2 2"}],["path",{d:"M21 19a2 2 0 0 1-2 2"}],["path",{d:"M5 21a2 2 0 0 1-2-2"}],["path",{d:"M9 3h1"}],["path",{d:"M9 21h1"}],["path",{d:"M14 3h1"}],["path",{d:"M14 21h1"}],["path",{d:"M3 9v1"}],["path",{d:"M21 9v1"}],["path",{d:"M3 14v1"}],["path",{d:"M21 14v1"}]];ua(l,Ra({name:"square-dashed"},()=>e,{get iconNode(){return v},children:(o,r)=>{var i=Q(),b=E(i);Da(b,()=>a.children??Xt),u(o,i)},$$slots:{default:!0}})),F()}const ja=({annotationIndex:l,...a})=>{const e=Et({isLoading:!1});return(async()=>{e.update(o=>({...o,isLoading:!0}));try{const{data:o}=await aa({path:{dataset_id:a.dataset_id},query:{cursor:l>0?l-1:0,limit:3,annotation_label_ids:a.annotation_label_ids,tag_ids:a.tag_ids}});if(!o){e.update(s=>({...s,isLoading:!1,error:"No annotations data received",data:void 0}));return}const{setAnnotationsTotalCount:r}=It();r(o.total_count);let i;const b=l>0?o.data[0]:void 0;o.data.length>1&&(i=l===0?o.data[1]:o.data[2]),e.update(s=>({...s,isLoading:!1,error:void 0,data:{annotationNext:i,annotationPrevious:b}}))}catch(o){e.update(r=>({...r,isLoading:!1,error:String(o)}))}})(),e},Ta=async({parent:l,params:{dataset_id:a,annotationId:e,annotationIndex:v}})=>{const{annotationsSelectedTagsIds:o,annotationsSelectedAnnotationLabelsIds:r,dataset:i}=await l(),b=parseInt(v,10),s=Et();if(!i)throw new Error("Dataset data not found");return ja({annotationIndex:b,dataset_id:a,currentAnnotationId:e,annotation_label_ids:Array.from(pt(r)),tag_ids:Array.from(pt(o))}).subscribe(({data:S})=>{s.set(S)}),{annotationAdjacents:s,annotationIndex:b,annotationId:e,dataset:i}},Be=Object.freeze(Object.defineProperty({__proto__:null,load:Ta},Symbol.toStringTag,{value:"Module"}));function Ha(l,a){z(a,!0);const e=()=>j(t(i),"$annotationAdjacents",v),[v,o]=W(),r=n(()=>U.data.annotationIndex),i=n(()=>U.data.annotationAdjacents),b=()=>{e().annotationNext&&nt(K.toSampleWithAnnotation({datasetId:e().annotationNext.dataset_id,sampleId:e().annotationNext.sample_id,annotationId:e().annotationNext.annotation_id,annotationIndex:t(r)+1}),{invalidateAll:!0})},s=()=>{e().annotationPrevious&&nt(K.toSampleWithAnnotation({datasetId:e().annotationPrevious.dataset_id,sampleId:e().annotationPrevious.sample_id,annotationId:e().annotationPrevious.annotation_id,annotationIndex:t(r)-1}),{invalidateAll:!0})},S=_=>{switch(_.key){case"ArrowRight":b();break;case"ArrowLeft":s();break}};var k=Q();bt("keydown",ht,S);var I=E(k);{var R=_=>{{let A=n(()=>!!e().annotationPrevious),$=n(()=>!!e().annotationNext);Ca(_,{get hasPrevious(){return t(A)},get hasNext(){return t($)},onPrevious:s,onNext:b})}};H(I,_=>{e()&&_(R)})}u(l,k),F(),o()}const Ua={object_detection:"Object Detection",instance_segmentation:"Instance Segmentation",semantic_segmentation:"Semantic Segmentation",classification:"Classification"};var za=B('<span class="text-sm"> </span> <span class="break-all text-sm"> </span>',1);function Fa(l,a){var e=za(),v=E(e),o=p(v,!0);g(v);var r=M(v,2),i=p(r,!0);g(r),q(()=>{V(o,a.label),ot(r,"data-testid",`annotation-metadata-${a.id}`),V(i,a.value)}),u(l,e)}var Oa=B('<span class="break-all text-sm"> </span>'),Ga=B('<span class="text-sm"> </span> <!>',1);function Ka(l,a){z(a,!0);const e=()=>j(i,"$result",o),v=()=>j(a.isEditingMode,"$isEditingMode",o),[o,r]=W(),i=va(),{updateAnnotation:b}=st({datasetId:a.datasetId,annotationId:a.annotationId,onUpdate:a.onUpdate}),s=n(()=>ga(e().data||[])),S=n(()=>{const w=t(s).find(d=>d.value===a.value);return w||{value:a.value,label:a.value}});var k=Ga(),I=E(k),R=p(I,!0);g(I);var _=M(I,2);{var A=w=>{{const d=(P,m)=>{let C=()=>m==null?void 0:m().inputValue;fa(P,{get label(){return C()}})};let h=n(()=>t(s).find(P=>{var m;return P.value===((m=t(S))==null?void 0:m.value)}));ma(w,{get items(){return t(s)},get selectedItem(){return t(h)},name:"annotation-label",placeholder:"Select or create a label",onSelect:P=>{b({annotation_id:a.annotationId,dataset_id:a.datasetId,label_name:P.value})},notFound:d,$$slots:{notFound:!0}})}},$=w=>{var d=Oa();ot(d,"data-testid","annotation-metadata-label");var h=p(d,!0);g(d),q(()=>V(h,a.value)),u(w,d)};H(_,w=>{v()?w(A):w($,!1)})}q(()=>V(R,a.label)),u(l,k),F(),r()}var qa=B('<div class="flex flex-col gap-4"><div class="grid grid-cols-[6rem_1fr] gap-y-3 text-diffuse-foreground"></div></div>');function Wa(l,a){z(a,!0);const e=()=>j(t(b),"$annotationResp",v),[v,o]=W(),{datasetId:r}=U.data,i=n(()=>st({datasetId:r,annotationId:a.annotationId})),b=n(()=>t(i).annotation);let s=n(()=>e().data);const S=n(()=>{var $,w;if(!t(s))return[];let A=[{id:"label",label:"Label:",value:(w=($=t(s))==null?void 0:$.annotation_label)==null?void 0:w.annotation_label_name},{id:"type",label:"Type:",value:Ua[t(s).annotation_type]||"Unknown"}];if(t(s)&&!_a(t(s))){const{height:d,width:h}=xt(t(s));A=[{id:"height",label:"Height:",value:Rt(Math.round(d))+"px"},{id:"width",label:"Width:",value:Rt(Math.round(h))+"px"},...A]}return A}),{isEditingMode:k}=U.data.globalStorage;var I=Q(),R=E(I);{var _=A=>{pa(A,{title:"Annotation details",children:($,w)=>{var d=qa(),h=p(d);na(h,21,()=>t(S),({label:P,value:m,id:C})=>P,(P,m)=>{let C=()=>t(m).label,y=()=>t(m).value,f=()=>t(m).id;var x=Q(),L=E(x);{var T=D=>{Ka(D,{get onUpdate(){return a.onUpdate},get annotationId(){return a.annotationId},get datasetId(){return r},get label(){return C()},get value(){return y()},get isEditingMode(){return k}})},c=D=>{Fa(D,{get label(){return C()},get id(){return f()},get value(){return y()}})};H(L,D=>{f()==="label"&&k?D(T):D(c,!1)})}u(P,x)}),g(h),g(d),u($,d)}})};H(R,A=>{t(S).length>0&&A(_)})}u(l,I),F(),o()}var Za=B('<!> <h2 class="py-2 text-lg font-semibold"><a>Check all sample annotations</a></h2>',1),Va=B('<div class="flex h-full w-full items-center justify-center"><!></div>'),Ja=B('<div class="flex h-full min-h-0 flex-col space-y-4 overflow-hidden dark:[color-scheme:dark]"><!> <!></div>');function Ya(l,a){z(a,!0);const e=()=>j(t(b),"$annotationResp",v),[v,o]=W(),{datasetId:r}=U.data,i=n(()=>st({datasetId:r,annotationId:a.annotationId})),b=n(()=>t(i).annotation);let s=n(()=>e().data),S=n(()=>{var _;return(_=t(s))==null?void 0:_.sample});const k=oa(),[I,R]=k;Lt(l,{className:"h-full",children:(_,A)=>{jt(_,{className:"h-full flex flex-col",children:($,w)=>{var d=Ja(),h=p(d);Wa(h,{get annotationId(){return a.annotationId},get onUpdate(){return a.onUpdate}});var P=M(h,2);{var m=y=>{var f=Za(),x=E(f);ha(x,{get sample(){return t(S)},showCustomMetadata:!1});var L=M(x,2),T=p(L);g(L),q(c=>ot(T,"href",c),[()=>I(K.toSample({sampleId:t(S).sample_id,datasetId:t(S).dataset_id}),void 0)]),u(y,f)},C=y=>{var f=Va(),x=p(f);Tt(x,{size:"large",align:"center"}),g(f),u(y,f)};H(P,y=>{t(S)?y(m):y(C,!1)})}g(d),u($,d)},$$slots:{default:!0}})},$$slots:{default:!0}}),F(),o()}var Qa=B('<!> <span class="hidden sm:inline">Home</span>',1),Xa=B('<!> <span class="max-w-[150px] truncate"> </span>',1),te=B('<!> <span class="hidden sm:inline">Annotations</span>',1),ae=B('<!> <span class="max-w-[200px] truncate"><!></span>',1),ee=B("<!> <!> <!> <!> <!> <!> <!>",1);function ne(l,a){z(a,!0);const e=()=>j(r,"$annotationsTotalCount",v),[v,o]=W(),{annotationsTotalCount:r}=It();$a(l,{class:"mb-2",children:(i,b)=>{wa(i,{children:(s,S)=>{var k=ee(),I=E(k);et(I,{children:(h,P)=>{{let m=n(()=>K.toHome());gt(h,{get href(){return t(m)},class:"flex items-center gap-2",children:(C,y)=>{var f=Qa(),x=E(f);Sa(x,{class:"h-4 w-4"}),Ct(2),u(C,f)},$$slots:{default:!0}})}},$$slots:{default:!0}});var R=M(I,2);_t(R,{});var _=M(R,2);et(_,{children:(h,P)=>{{let m=n(()=>K.toAnnotations(a.dataset.dataset_id));gt(h,{get href(){return t(m)},class:"flex items-center gap-2",children:(C,y)=>{var f=Xa(),x=E(f);ya(x,{class:"h-4 w-4"});var L=M(x,2),T=p(L,!0);g(L),q(()=>V(T,a.dataset.name)),u(C,f)},$$slots:{default:!0}})}},$$slots:{default:!0}});var A=M(_,2);_t(A,{});var $=M(A,2);et($,{children:(h,P)=>{{let m=n(()=>K.toAnnotations(a.dataset.dataset_id));gt(h,{get href(){return t(m)},class:"flex items-center gap-2",children:(C,y)=>{var f=te(),x=E(f);Ba(x,{class:"h-4 w-4"}),Ct(2),u(C,f)},$$slots:{default:!0}})}},$$slots:{default:!0}});var w=M($,2);_t(w,{});var d=M(w,2);et(d,{children:(h,P)=>{Ma(h,{class:"flex items-center gap-2",children:(m,C)=>{var y=ae(),f=E(y);La(f,{class:"h-4 w-4"});var x=M(f,2),L=p(x);{var T=D=>{var O=Dt();q(()=>V(O,`Annotation ${a.annotationIndex+1} of ${e()??""}`)),u(D,O)},c=D=>{var O=Dt("Annotation");u(D,O)};H(L,D=>{a.annotationIndex!==void 0?D(T):D(c,!1)})}g(x),u(m,y)},$$slots:{default:!0}})},$$slots:{default:!0}}),u(s,k)},$$slots:{default:!0}})},$$slots:{default:!0}}),F(),o()}var oe=ea("<image></image><g><!></g>",1),se=B('<div class="h-full w-full overflow-hidden"><div class="sample relative h-full w-full"><div class="absolute right-4 top-2 z-30"><!></div> <!> <!></div></div>'),ie=B('<div class="flex h-full w-full items-center justify-center"><!></div>'),re=B('<div class="flex h-full w-full flex-col space-y-4"><div class="flex w-full items-center"><!></div> <!> <div class="flex min-h-0 flex-1 gap-4"><div class="flex-1"><!></div> <div class="relative w-[375px]"><!></div></div></div>');function de(l,a){z(a,!0);const e=()=>j(Ht,"$isEditingMode",i),v=()=>j(t(f),"$annotationResp",i),o=()=>j(S,"$selectedSampleAnnotationCropIds",i),r=()=>j(R,"$isHidden",i),[i,b]=W(),{toggleSampleAnnotationCropSelection:s,selectedSampleAnnotationCropIds:S,clearReversibleActionsByGroupId:k,addReversibleAction:I}=It(),{isHidden:R,handleKeyEvent:_}=ba(),{settingsStore:A}=sa(),$=" ",w=pt(A).key_go_back;let d=Bt(!1);const h=()=>{var N;(N=a.sample)!=null&&N.dataset_id?nt(K.toAnnotations(a.sample.dataset_id)):nt("/")},P=N=>{switch(N.key){case w:h();break;case" ":N.preventDefault(),e()?at(d,!0):s(a.annotationId);break;case $:N.preventDefault(),s(a.annotationId);break}_(N)},m=N=>{N.key===" "&&at(d,!1),_(N)},C=U.data.datasetId,y=n(()=>st({datasetId:C,annotationId:a.annotationId})),f=n(()=>t(y).annotation),x=n(()=>t(y).updateAnnotation),L="bbox-change-annotation-details";la(()=>{k(L)});const T=N=>{if(t(c)){const J={annotation_id:t(c).annotation_id,dataset_id:t(c).dataset_id,bounding_box:N},lt=xt(t(c)),St=async()=>{const Y={annotation_id:t(c).annotation_id,dataset_id:t(c).dataset_id,bounding_box:lt};await t(x)(Y)};(async()=>{try{await t(x)(J),I({id:`bbox-change-${t(c).annotation_id}-${Date.now()}`,description:`Revert bounding box change for annotation ${t(c).annotation_id}`,execute:St,timestamp:new Date,groupId:L})}catch(Y){da.error("Failed to update annotations:"+Y.message)}})()}};let c=n(()=>v().data),D=n(()=>{var N,J;return Pa(((J=(N=t(c))==null?void 0:N.sample)==null?void 0:J.sample_id)||"")}),O=n(()=>t(c)?xt(t(c)):void 0);const{isEditingMode:Ht}=U.data.globalStorage,Ut=n(()=>t(d)?"grab":"auto"),zt=n(()=>e()&&!t(d));let X=Bt(void 0);ta(()=>{!t(X)&&t(O)&&at(X,t(O),!0)}),ca(()=>{at(X,void 0)});var it=re();bt("keydown",ht,P),bt("keyup",ht,m);var rt=p(it),Ft=p(rt);ne(Ft,{get dataset(){return a.dataset},get annotationIndex(){return a.annotationIndex}}),g(rt);var At=M(rt,2);Aa(At,{class:"mb-4 bg-border-hard"});var $t=M(At,2),dt=p($t),Ot=p(dt);Lt(Ot,{className:"h-full",children:(N,J)=>{jt(N,{className:"h-full",children:(lt,St)=>{var ct=Q(),Y=E(ct);{var Kt=Z=>{var G=se(),tt=p(G),ut=p(tt),Wt=p(ut);{let Mt=n(()=>o().has(a.annotationId));xa(Wt,{onSelect:()=>s(a.annotationId),get isSelected(){return t(Mt)}})}g(ut);var yt=M(ut,2);Ha(yt,{});var Zt=M(yt,2);ka(Zt,{get width(){return t(c).sample.width},get height(){return t(c).sample.height},get cursor(){return t(Ut)},get boundingBox(){return t(X)},zoomableContent:(Vt,vt)=>{let Jt=()=>vt==null?void 0:vt().scale;var kt=oe(),Pt=E(kt),mt=M(Pt);let Nt;var Yt=p(mt);ia(Yt,()=>v().dataUpdatedAt,ft=>{{let Qt=n(()=>({x:0,y:0,width:t(c).sample.width,height:t(c).sample.height}));Ia(ft,{get annotation(){return t(c)},showLabel:!0,get scale(){return Jt()},get imageWidth(){return t(c).sample.width},get isResizable(){return t(zt)},onBoundingBoxChanged:T,get constraintBox(){return t(Qt)}})}}),g(mt),q(ft=>{ot(Pt,"href",t(D)),Nt=ra(mt,0,"",null,Nt,ft)},[()=>({invisible:r()})]),u(Vt,kt)},$$slots:{zoomableContent:!0}}),g(tt),g(G),u(Z,G)},qt=Z=>{var G=ie(),tt=p(G);Tt(tt,{size:"large",align:"center"}),g(G),u(Z,G)};H(Y,Z=>{t(c)?Z(Kt):Z(qt,!1)})}u(lt,ct)},$$slots:{default:!0}})},$$slots:{default:!0}}),g(dt);var wt=M(dt,2),Gt=p(wt);Ya(Gt,{get annotationId(){return a.annotationId}}),g(wt),g($t),g(it),u(l,it),F(),b()}var le=B('<div class="flex h-full w-full space-x-4 px-4 pb-4" data-testid="annotation-details"><div class="h-full w-full space-y-6 rounded-[1vw] bg-card p-4"><!></div></div>');function De(l,a){z(a,!0);const e=()=>j(t(k),"$sample",v),[v,o]=W(),r=n(()=>a.data.annotationId),i=n(()=>a.data.dataset),b=n(()=>a.data.annotationIndex),s=n(()=>U.params.sampleId),S=n(()=>Na({sampleId:t(s),datasetId:t(i).dataset_id})),k=n(()=>t(S).sample);var I=le(),R=p(I),_=p(R);{var A=$=>{de($,{get annotationId(){return t(r)},get annotationIndex(){return t(b)},get dataset(){return t(i)},get sample(){return e().data}})};H(_,$=>{e().data&&t(r)&&t(i)&&$(A)})}g(R),g(I),u(l,I),F(),o()}export{De as component,Be as universal};
@@ -0,0 +1 @@
1
+ import"../chunks/CWj6FrbW.js";import{p as Se,al as I,ab as ze,u as xe,g as e,b as d,Z as h,c as v,s as V,f as R,r as f,t as le,a as ye,w as He,m as _e,am as Ne}from"../chunks/C3xJX0nD.js";import{f as T,c as D,a as l}from"../chunks/CAPx0Bfm.js";import{i as W,a as Te,s as ve}from"../chunks/DmGM9V9Q.js";import{a as We,S as qe,e as Fe,s as oe,u as Oe,k as je,b as Ke}from"../chunks/DthpwYR_.js";import{p as P,r as Qe,b as ke}from"../chunks/xQhUoIl9.js";import{r as Re,u as Ve}from"../chunks/DyIcJj6J.js";import{h as Ae,i as te,s as Be,j as Ge,k as Ee,l as Ye,n as Ie,L as Ze}from"../chunks/CWuDkrMZ.js";import{S as De}from"../chunks/BiGQqqJP.js";import{u as Je}from"../chunks/BOmrKuMn.js";import"../chunks/ClzkJBWk.js";import"../chunks/BaFFwDFr.js";import"../chunks/DUtlYNuP.js";import"../chunks/69_IOA4Y.js";import"../chunks/D8ZGoCPm.js";import"../chunks/gBp1tBnA.js";import{I as Ue}from"../chunks/CP9M7pei.js";import{s as Z}from"../chunks/DoEId1MK.js";import{s as Xe}from"../chunks/CpbA3HU7.js";const $e=Be(),et=Ge();var tt=T("<div><!></div>"),it=T("<div><!></div>"),at=T("<div><!></div>"),rt=T("<div><!></div>"),st=T("<div><!></div>"),ot=T("<div><!> <div><!> <!></div> <!></div>");function lt(q,i){Se(i,!0);let m=P(i,"height",3,"100%"),k=P(i,"width",3,"100%"),p=P(i,"stickyIndices",19,()=>[]),M=P(i,"overScan",3,1),b=P(i,"marginLeft",3,0),o=P(i,"marginTop",3,0),O=P(i,"layout",3,"vertical"),w=P(i,"scrollPosition",15,0),ie=P(i,"scrollAlignment",3,"auto"),z=P(i,"scrollBehavior",3,"auto"),fe=P(i,"getKey",3,t=>t),ae=Qe(i,["$$slots","$$events","$$legacy","itemCount","itemSize","height","width","stickyIndices","overScan","marginLeft","marginTop","layout","scrollPosition","scrollAlignment","scrollBehavior","getKey","onscroll","header","item","placeholder","footer"]),_=I(void 0),j=I(ze(w())),re=I(0),A=I(0),ne=I(0),de=I(0),J=I(0),U=I(0),B=I(ze([])),K=!1,X=!1,G=I(!1);function me(t,r=ie(),g=z()){u(ue(t,r),g)}function he(t,r=z()){u(t,r)}const ue=(t,r)=>{const g=e(c)?o()+e(re):b()+e(A),S=t*i.itemSize+g,N=S-e(L)+i.itemSize+g;let a;switch(r){case"start":a=S;break;case"center":a=S-(e(L)-i.itemSize)/2;break;case"end":a=N;break;default:a=Math.max(N,Math.min(S,w()));break}return Math.max(0,Math.min(e(ce)-e(L),a))},u=(t,r=z())=>{e(_)&&(K=!0,e(_).scrollTo({[e(c)?"top":"left"]:t,behavior:r}),K=!1)},Q=t=>{e(_)&&!K&&!X&&(K=!0,e(_).scrollTo({top:t,behavior:z()}),K=!1)},se=t=>{const r=t*i.itemSize;return`position: absolute; transform: translate3d(${e(c)?`${b()}px, ${r+o()}px`:`${e(A)+r+b()}px, ${o()}px`}, 0px); ${e(pe)} will-change: transform;`},ge=t=>{X=!0,K||(e(c)?(h(j,Math.max(0,t.currentTarget.scrollTop-e(re)),!0),w(t.currentTarget.scrollTop)):(h(j,Math.max(0,t.currentTarget.scrollLeft-e(A)),!0),w(t.currentTarget.scrollLeft)),e(C)(e(j))),$e(()=>{X=!1})};let c=d(()=>O()==="vertical"),ce=d(()=>i.itemCount*i.itemSize),pe=d(()=>e(c)?`height: ${i.itemSize}px; width: ${b()>0?`${e(U)-b()}px`:"100%"};`:`height: ${o()>0?`${e(de)-o()}px`:"100%"}; width: ${i.itemSize}px;`),L=d(()=>e(c)?e(ne):e(J));xe(()=>{e(L)&&h(B,Ae(i.itemCount,i.itemSize,e(L),M(),e(j)),!0)}),xe(()=>{e(_)&&Q(w())});let C=d(()=>et(e(L),{fast:()=>{h(G,!0)},slow:()=>{h(G,!1)}}));var $={scrollToIndex:me,scrollToPosition:he},x=ot(),F=t=>{var r;ge(t),(r=i.onscroll)==null||r.call(i,t)};We(x,t=>({onscroll:F,...ae,[qe]:t}),[()=>({position:"relative",overflow:"auto",height:typeof m()=="number"?`${m()}px`:m(),width:typeof k()!="number"?k():`${k()}px`})]);var H=v(x);{var E=t=>{var r=D(),g=R(r);{var S=a=>{var s=tt(),n=v(s);Z(n,()=>i.header),f(s),te(s,"offsetHeight",y=>h(re,y)),l(a,s)},N=a=>{var s=it();oe(s,"",{},{position:"absolute"});var n=v(s);Z(n,()=>i.header),f(s),te(s,"offsetWidth",y=>h(A,y)),l(a,s)};W(g,a=>{e(c)?a(S):a(N,!1)})}l(t,r)};W(H,t=>{i.header&&t(E)})}var ee=V(H,2);let be;var we=v(ee);{var Ce=t=>{const r=d(()=>Math.max(...p().filter(a=>a<e(B)[0])));var g=D(),S=R(g);{var N=a=>{var s=at();let n;var y=v(s);Z(y,()=>i.item,()=>({index:e(r),style:""})),f(s),le(Y=>n=oe(s,"",n,Y),[()=>({position:"sticky",top:e(c)?`${o()}px`:"0px",left:e(c)?"0px":`${b()}px`,"z-index":"1"})]),l(a,s)};W(S,a=>{e(r)>=0&&a(N)})}l(t,g)};W(we,t=>{p().length&&e(B).length&&t(Ce)})}var Pe=V(we,2);Fe(Pe,17,()=>e(B),t=>fe()(t),(t,r)=>{const g=d(()=>se(e(r)));var S=D(),N=R(S);{var a=n=>{var y=D(),Y=R(y);Z(Y,()=>i.item,()=>({index:e(r),style:e(g)})),l(n,y)},s=n=>{var y=D(),Y=R(y);Z(Y,()=>i.placeholder,()=>({index:e(r),style:e(g)})),l(n,y)};W(N,n=>{!e(G)||!i.placeholder?n(a):n(s,!1)})}l(t,S)}),f(ee);var Me=V(ee,2);{var Le=t=>{var r=D(),g=R(r);{var S=a=>{var s=rt(),n=v(s);Z(n,()=>i.footer),f(s),l(a,s)},N=a=>{var s=st();let n;var y=v(s);Z(y,()=>i.footer),f(s),le(Y=>n=oe(s,"",n,Y),[()=>({position:"absolute",top:"0px",left:`${e(A)+i.itemCount*i.itemSize+b()}px`})]),l(a,s)};W(g,a=>{e(c)?a(S):a(N,!1)})}l(t,r)};W(Me,t=>{i.footer&&t(Le)})}return f(x),ke(x,t=>h(_,t),()=>e(_)),le(t=>be=oe(ee,"",be,t),[()=>({height:e(c)?`${e(ce)}px`:"100%",width:e(c)?"100%":`${e(ce)}px`})]),te(x,"offsetHeight",t=>h(ne,t)),te(x,"clientHeight",t=>h(de,t)),te(x,"offsetWidth",t=>h(J,t)),te(x,"clientWidth",t=>h(U,t)),l(q,x),ye($)}const nt=(...q)=>{const i=Re(...q),m=Ee({...i,getNextPageParam:o=>o.nextCursor||void 0}),k=Ve(),p=()=>{k.invalidateQueries({queryKey:i.queryKey})},M=He([]);return m.subscribe(o=>{if(o.isSuccess){const O=o.data.pages.flatMap(w=>w.data);M.set(O)}}),{data:M,loadMore:()=>{_e(m).hasNextPage&&!_e(m).isFetchingNextPage&&_e(m).fetchNextPage()},query:m,refresh:p}};var dt=T('<div class="flex flex-row items-center gap-10"><!> <div class="flex-1 text-sm text-foreground"> </div></div>');function ct(q,i){Se(i,!0);const m=()=>ve(M,"$gridViewSampleRenderingStore",k),[k,p]=Te(),{gridViewSampleRenderingStore:M}=Oe();let b=d(m);var o=dt(),O=v(o);Ye(O,{get sample(){return i.item.sample},get objectFit(){return e(b)}});var w=V(O,2),ie=v(w,!0);f(w),f(o),le(()=>Xe(ie,i.item.text)),l(q,o),ye(),p()}var vt=T('<div class="flex h-full w-full items-center justify-center"><!> <div>Loading samples...</div></div>'),ft=T("<div><!></div>"),mt=T('<div class="flex justify-center p-4"><!></div>'),ht=T("<!> <!>",1),ut=T('<div class="flex flex-1 flex-col space-y-4"><div class="my-2 flex items-center space-x-4"><div class="flex-1"><div class="text-2xl font-semibold">Captions</div></div> <div class="w-4/12"><!></div></div> <!> <div class="h-full w-full flex-1 overflow-hidden"><!></div></div>');function gt(q,i){Se(i,!0);const m=()=>ve(e(O),"$data",M),k=()=>ve(fe,"$sampleSize",M),p=()=>ve(e(w),"$query",M),[M,b]=Te(),o=d(()=>nt({path:{dataset_id:i.datasetId}})),O=d(()=>e(o).data),w=d(()=>e(o).query),ie=d(()=>e(o).loadMore);let z=I(null);const{sampleSize:fe}=Je();let ae=I(0);xe(()=>{if(!e(z))return;h(ae,e(z).clientHeight,!0);const u=new ResizeObserver(()=>{e(z)&&h(ae,e(z).clientHeight,!0)});return u.observe(e(z)),()=>{u.disconnect()}});let _=d(m);const j=16,re=d(()=>k().height+j),A=d(()=>k().width),ne=d(()=>k().height),de=d(()=>e(ae)+j);var J=ut(),U=v(J),B=V(v(U),2),K=v(B);Ue(K,{}),f(B),f(U);var X=V(U,2);De(X,{class:"mb-4 bg-border-hard"});var G=V(X,2),me=v(G);{var he=u=>{var Q=vt(),se=v(Q);Ie(se,{}),Ne(2),f(Q),l(u,Q)},ue=u=>{var Q=D(),se=R(Q);{var ge=c=>{lt(c,{get itemCount(){return e(_).length},get itemSize(){return e(re)},get height(){return e(de)},class:"dark:[color-scheme:dark]",get style(){return`--sample-width: ${e(A)??""}px; --sample-height: ${e(ne)??""}px;`},item:(L,C)=>{let $=()=>C==null?void 0:C().index,x=()=>C==null?void 0:C().style;var F=ft();Ke(F,1,`pb-[${j}]`);var H=v(F);ct(H,{get item(){return e(_)[$()]}}),f(F),le(()=>oe(F,x())),l(L,F)},footer:L=>{var C=ht(),$=R(C);je($,()=>e(_).length,H=>{{let E=d(()=>!p().hasNextPage||p().isFetchingNextPage);Ze(H,{get onIntersect(){return e(ie)},get disabled(){return e(E)}})}});var x=V($,2);{var F=H=>{var E=mt(),ee=v(E);Ie(ee,{}),f(E),l(H,E)};W(x,H=>{p().isFetchingNextPage&&H(F)})}l(L,C)},$$slots:{item:!0,footer:!0}})};W(se,c=>{p().isSuccess&&e(_).length>0&&c(ge)},!0)}l(u,Q)};W(me,u=>{p().isPending&&e(_).length===0?u(he):u(ue,!1)})}f(G),ke(G,u=>h(z,u),()=>e(z)),f(J),l(q,J),ye(),b()}function Ft(q,i){const{datasetId:m}=i.data;gt(q,{get datasetId(){return m}})}export{Ft as component};
@@ -1 +1 @@
1
- {"version":"1759479212790"}
1
+ {"version":"1761033043766"}
@@ -5,35 +5,36 @@
5
5
  <link rel="icon" href="/favicon.png" />
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
7
 
8
- <link rel="modulepreload" href="/_app/immutable/entry/start.u7zsVvqp.js">
9
- <link rel="modulepreload" href="/_app/immutable/chunks/DEgUu98i.js">
10
- <link rel="modulepreload" href="/_app/immutable/chunks/CH6P3X75.js">
8
+ <link rel="modulepreload" href="/_app/immutable/entry/start.CvxVp0Cu.js">
9
+ <link rel="modulepreload" href="/_app/immutable/chunks/D8ZGoCPm.js">
10
+ <link rel="modulepreload" href="/_app/immutable/chunks/C3xJX0nD.js">
11
11
  <link rel="modulepreload" href="/_app/immutable/chunks/DIeogL5L.js">
12
12
  <link rel="modulepreload" href="/_app/immutable/chunks/CYgJF_JY.js">
13
- <link rel="modulepreload" href="/_app/immutable/entry/app.BVr6DYqP.js">
14
- <link rel="modulepreload" href="/_app/immutable/chunks/DQXoLcsF.js">
15
- <link rel="modulepreload" href="/_app/immutable/chunks/DA6bFLPR.js">
16
- <link rel="modulepreload" href="/_app/immutable/chunks/BfHVnyNT.js">
13
+ <link rel="modulepreload" href="/_app/immutable/entry/app.Y-sSoz5q.js">
14
+ <link rel="modulepreload" href="/_app/immutable/chunks/C1FmrZbK.js">
15
+ <link rel="modulepreload" href="/_app/immutable/chunks/WEyXQRi6.js">
17
16
  <link rel="modulepreload" href="/_app/immutable/chunks/CWj6FrbW.js">
18
17
  <link rel="modulepreload" href="/_app/immutable/chunks/69_IOA4Y.js">
19
- <link rel="modulepreload" href="/_app/immutable/chunks/Cs1XmhiF.js">
20
- <link rel="modulepreload" href="/_app/immutable/chunks/DGTPl6Gk.js">
21
- <link rel="modulepreload" href="/_app/immutable/chunks/D4whDBUi.js">
22
- <link rel="modulepreload" href="/_app/immutable/chunks/RmD8FzRo.js">
18
+ <link rel="modulepreload" href="/_app/immutable/chunks/BPpOWbDa.js">
19
+ <link rel="modulepreload" href="/_app/immutable/chunks/CpbA3HU7.js">
20
+ <link rel="modulepreload" href="/_app/immutable/chunks/SiegjVo0.js">
21
+ <link rel="modulepreload" href="/_app/immutable/chunks/CAPx0Bfm.js">
22
+ <link rel="modulepreload" href="/_app/immutable/chunks/DmGM9V9Q.js">
23
+ <link rel="modulepreload" href="/_app/immutable/chunks/xQhUoIl9.js">
23
24
  </head>
24
25
  <body data-sveltekit-preload-data="hover" class="flex h-screen w-screen flex-col dark:bg-black">
25
26
  <div style="display: contents">
26
27
  <script>
27
28
  {
28
- __sveltekit_1gqf9ui = {
29
+ __sveltekit_6ycv9w = {
29
30
  base: ""
30
31
  };
31
32
 
32
33
  const element = document.currentScript.parentElement;
33
34
 
34
35
  Promise.all([
35
- import("/_app/immutable/entry/start.u7zsVvqp.js"),
36
- import("/_app/immutable/entry/app.BVr6DYqP.js")
36
+ import("/_app/immutable/entry/start.CvxVp0Cu.js"),
37
+ import("/_app/immutable/entry/app.Y-sSoz5q.js")
37
38
  ]).then(([kit, app]) => {
38
39
  kit.start(app, element);
39
40
  });
@@ -5,11 +5,15 @@ from pathlib import Path
5
5
  from environs import Env
6
6
 
7
7
  import lightly_studio as ls
8
+ from lightly_studio import db_manager
8
9
 
9
10
  # Read environment variables
10
11
  env = Env()
11
12
  env.read_env()
12
13
 
14
+ # Cleanup an existing database
15
+ db_manager.connect(cleanup_existing=True)
16
+
13
17
  # Define the path to the dataset directory
14
18
  dataset_path = Path(env.path("DATASET_PATH", "/path/to/your/dataset"))
15
19
  dataset_path = dataset_path.parent if dataset_path.is_file() else dataset_path
@@ -1,6 +1,10 @@
1
1
  """Example of how to add samples in coco format to a dataset."""
2
2
 
3
3
  import lightly_studio as ls
4
+ from lightly_studio import db_manager
5
+
6
+ # Cleanup an existing database
7
+ db_manager.connect(cleanup_existing=True)
4
8
 
5
9
  # Create a DatasetLoader from a path
6
10
  dataset = ls.Dataset.create()
@@ -0,0 +1,24 @@
1
+ """Example of how to add samples in coco caption format to a dataset."""
2
+
3
+ import lightly_studio as ls
4
+ from lightly_studio import db_manager
5
+ from lightly_studio.resolvers import caption_resolver
6
+
7
+ # Cleanup an existing database
8
+ db_manager.connect(cleanup_existing=True)
9
+
10
+ # Create a DatasetLoader from a path
11
+ dataset = ls.Dataset.create()
12
+ dataset.add_samples_from_coco_caption(
13
+ annotations_json="/path/to/your/dataset/annotations.json",
14
+ images_path="/path/to/your/dataset",
15
+ )
16
+
17
+ # Display some details about the captions
18
+ captions_result = caption_resolver.get_all(session=dataset.session, dataset_id=dataset.dataset_id)
19
+ print(captions_result.total_count)
20
+
21
+ for caption in captions_result.captions[:10]:
22
+ print(caption)
23
+
24
+ ls.start_gui()
@@ -83,7 +83,7 @@ def add_bulk_metadata(session: Session, sample_ids: list[UUID]) -> None:
83
83
 
84
84
  # Bulk insert metadata
85
85
  start_time = time.time()
86
- metadata_resolver.bulk_set_metadata(session, sample_metadata)
86
+ metadata_resolver.bulk_update_metadata(session, sample_metadata)
87
87
  elapsed_time = time.time() - start_time
88
88
 
89
89
  print(f"✅ Added metadata to {len(sample_ids)} samples in {elapsed_time:.2f}s")
@@ -293,6 +293,9 @@ def demonstrate_dictionary_like_access(samples: list[Sample]) -> None:
293
293
  def main() -> None:
294
294
  """Main function to demonstrate metadata functionality."""
295
295
  try:
296
+ # Cleanup an existing database
297
+ db_manager.connect(cleanup_existing=True)
298
+
296
299
  # Load existing dataset
297
300
  dataset, samples = load_existing_dataset()
298
301
 
@@ -5,11 +5,15 @@ from pathlib import Path
5
5
  from environs import Env
6
6
 
7
7
  import lightly_studio as ls
8
+ from lightly_studio import db_manager
8
9
 
9
10
  # Read environment variables
10
11
  env = Env()
11
12
  env.read_env()
12
13
 
14
+ # Cleanup an existing database
15
+ db_manager.connect(cleanup_existing=True)
16
+
13
17
  # Define the path to the dataset directory
14
18
  dataset_path = Path(env.path("DATASET_PATH", "/path/to/your/dataset"))
15
19
  dataset_path = dataset_path.parent if dataset_path.is_file() else dataset_path
@@ -5,11 +5,15 @@ import math
5
5
  from environs import Env
6
6
 
7
7
  import lightly_studio as ls
8
+ from lightly_studio import db_manager
8
9
 
9
10
  # Read environment variables
10
11
  env = Env()
11
12
  env.read_env()
12
13
 
14
+ # Cleanup an existing database
15
+ db_manager.connect(cleanup_existing=True)
16
+
13
17
  # Create a Dataset instance
14
18
  dataset = ls.Dataset.create()
15
19
 
@@ -5,11 +5,15 @@ from pathlib import Path
5
5
  from environs import Env
6
6
 
7
7
  import lightly_studio as ls
8
+ from lightly_studio import db_manager
8
9
 
9
10
  # Read environment variables
10
11
  env = Env()
11
12
  env.read_env()
12
13
 
14
+ # Cleanup an existing database
15
+ db_manager.connect(cleanup_existing=True)
16
+
13
17
  # Define the path to the dataset directory
14
18
  dataset_path = Path(env.path("DATASET_PATH", "/path/to/your/dataset"))
15
19
 
@@ -1,5 +1,7 @@
1
1
  """Exports datasets from Lightly Studio into various formats."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  from pathlib import Path
4
6
  from typing import Iterable
5
7
 
@@ -8,6 +10,9 @@ from sqlmodel import Session
8
10
 
9
11
  from lightly_studio.core.sample import Sample
10
12
  from lightly_studio.export.lightly_studio_label_input import LightlyStudioObjectDetectionInput
13
+ from lightly_studio.type_definitions import PathLike
14
+
15
+ DEFAULT_EXPORT_FILENAME = "coco_export.json"
11
16
 
12
17
 
13
18
  class DatasetExport:
@@ -27,19 +32,22 @@ class DatasetExport:
27
32
  self.session = session
28
33
  self.samples = samples
29
34
 
30
- def to_coco_object_detections(self, output_json: Path) -> None:
35
+ def to_coco_object_detections(self, output_json: PathLike | None = None) -> None:
31
36
  """Exports object detection annotations to a COCO format JSON file.
32
37
 
33
38
  Args:
34
- output_json: The path to the output COCO JSON file.
39
+ output_json: The path to the output COCO JSON file. If not provided,
40
+ defaults to "coco_export.json" in the current working directory.
35
41
 
36
42
  Raises:
37
43
  ValueError: If the annotation task with the given name does not exist.
38
44
  """
45
+ if output_json is None:
46
+ output_json = DEFAULT_EXPORT_FILENAME
39
47
  to_coco_object_detections(
40
48
  session=self.session,
41
49
  samples=self.samples,
42
- output_json=output_json,
50
+ output_json=Path(output_json),
43
51
  )
44
52
 
45
53
 
@@ -64,4 +64,4 @@ def compute_typicality_metadata(
64
64
  for sample, typicality in zip(samples, typicality_values)
65
65
  ]
66
66
 
67
- metadata_resolver.bulk_set_metadata(session, metadata)
67
+ metadata_resolver.bulk_update_metadata(session, metadata)
@@ -0,0 +1,74 @@
1
+ """This module defines the caption model."""
2
+
3
+ from datetime import datetime, timezone
4
+ from typing import TYPE_CHECKING, List, Optional
5
+ from uuid import UUID, uuid4
6
+
7
+ from pydantic import BaseModel, ConfigDict
8
+ from pydantic import Field as PydanticField
9
+ from sqlalchemy.orm import Mapped
10
+ from sqlmodel import Field, Relationship, SQLModel
11
+
12
+ if TYPE_CHECKING:
13
+ from lightly_studio.models.sample import SampleTable
14
+
15
+
16
+ class CaptionTable(SQLModel, table=True):
17
+ """Class for caption model."""
18
+
19
+ __tablename__ = "caption"
20
+
21
+ created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc), index=True)
22
+
23
+ caption_id: UUID = Field(default_factory=uuid4, primary_key=True)
24
+ dataset_id: UUID = Field(foreign_key="datasets.dataset_id")
25
+ sample_id: UUID = Field(foreign_key="samples.sample_id")
26
+
27
+ sample: Mapped[Optional["SampleTable"]] = Relationship(
28
+ back_populates="captions",
29
+ sa_relationship_kwargs={"lazy": "select"},
30
+ )
31
+
32
+ text: str
33
+
34
+
35
+ class CaptionCreate(SQLModel):
36
+ """Input model for creating captions."""
37
+
38
+ dataset_id: UUID
39
+ sample_id: UUID
40
+ text: str
41
+
42
+
43
+ class CaptionSampleView(SQLModel):
44
+ """Sample class for caption view."""
45
+
46
+ file_path_abs: str
47
+ file_name: str
48
+ dataset_id: UUID
49
+ sample_id: UUID
50
+
51
+
52
+ class CaptionView(SQLModel):
53
+ """Response model for caption."""
54
+
55
+ sample_id: UUID
56
+ dataset_id: UUID
57
+ caption_id: UUID
58
+ text: str
59
+
60
+
61
+ class CaptionDetailsView(CaptionView):
62
+ """Response model for caption."""
63
+
64
+ sample: CaptionSampleView
65
+
66
+
67
+ class CaptionsListView(BaseModel):
68
+ """Response model for counted captions."""
69
+
70
+ model_config = ConfigDict(populate_by_name=True)
71
+
72
+ captions: List[CaptionDetailsView] = PydanticField(..., alias="data")
73
+ total_count: int
74
+ next_cursor: Optional[int] = PydanticField(..., alias="nextCursor")
@@ -19,8 +19,7 @@ from lightly_studio.resolvers.samples_filter import SampleFilter
19
19
  class DatasetBase(SQLModel):
20
20
  """Base class for the Dataset model."""
21
21
 
22
- name: str
23
- directory: str
22
+ name: str = Field(unique=True, index=True)
24
23
 
25
24
 
26
25
  class DatasetCreate(DatasetBase):
@@ -188,7 +188,7 @@ class SampleMetadataTable(MetadataBase, table=True):
188
188
  """This class defines the SampleMetadataTable model."""
189
189
 
190
190
  __tablename__ = "metadata"
191
- sample_id: UUID = Field(foreign_key="samples.sample_id")
191
+ sample_id: UUID = Field(foreign_key="samples.sample_id", unique=True)
192
192
 
193
193
  sample: SampleTable = Relationship(back_populates="metadata_dict")
194
194
 
@@ -10,12 +10,14 @@ from sqlalchemy.orm import Mapped, Session
10
10
  from sqlmodel import Field, Relationship, SQLModel
11
11
 
12
12
  from lightly_studio.models.annotation.annotation_base import AnnotationView
13
+ from lightly_studio.models.caption import CaptionView
13
14
  from lightly_studio.resolvers import metadata_resolver
14
15
 
15
16
  if TYPE_CHECKING:
16
17
  from lightly_studio.models.annotation.annotation_base import (
17
18
  AnnotationBaseTable,
18
19
  )
20
+ from lightly_studio.models.caption import CaptionTable
19
21
  from lightly_studio.models.metadata import (
20
22
  SampleMetadataTable,
21
23
  SampleMetadataView,
@@ -24,6 +26,7 @@ if TYPE_CHECKING:
24
26
  from lightly_studio.models.tag import TagTable
25
27
  else:
26
28
  AnnotationBaseTable = object
29
+ CaptionTable = object
27
30
  SampleEmbeddingTable = object
28
31
  SampleMetadataTable = object
29
32
  TagTable = object
@@ -91,6 +94,9 @@ class SampleTable(SampleBase, table=True):
91
94
  annotations: Mapped[List["AnnotationBaseTable"]] = Relationship(
92
95
  back_populates="sample",
93
96
  )
97
+ captions: Mapped[List["CaptionTable"]] = Relationship(
98
+ back_populates="sample",
99
+ )
94
100
 
95
101
  """The tag ids associated with the sample."""
96
102
  tags: Mapped[List["TagTable"]] = Relationship(
@@ -170,8 +176,9 @@ class SampleView(SQLModel):
170
176
  file_path_abs: str
171
177
  sample_id: UUID
172
178
  dataset_id: UUID
173
- annotations: List["AnnotationView"] = Field([])
174
- tags: List[SampleViewTag] = Field([])
179
+ annotations: List["AnnotationView"]
180
+ captions: List[CaptionView] = []
181
+ tags: List[SampleViewTag]
175
182
  metadata_dict: Optional["SampleMetadataView"] = None
176
183
  width: int
177
184
  height: int
@@ -40,6 +40,11 @@ class SettingBase(SQLModel):
40
40
  description="Controls whether to show text labels on annotations",
41
41
  )
42
42
 
43
+ show_sample_filenames: bool = Field(
44
+ default=False,
45
+ description="Controls whether to show sample filenames in the samples grid view",
46
+ )
47
+
43
48
 
44
49
  class SettingView(SettingBase):
45
50
  """View class for Settings model."""