Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- README.md +2 -17
- src/README.md +2 -0
- src/backend/gradio_image_annotation/templates/component/index.js +0 -0
- src/frontend/shared/Canvas.svelte +7 -3
- src/frontend/shared/ImageAnnotator.svelte +3 -7
- src/images/demo.png +3 -0
- src/pyproject.toml +1 -1
.gitattributes
CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
src/images/demo_2.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
src/images/demo_2.png filter=lfs diff=lfs merge=lfs -text
|
37 |
+
src/images/demo.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,26 +1,11 @@
|
|
1 |
-
---
|
2 |
-
tags:
|
3 |
-
- gradio-custom-component
|
4 |
-
- gradio-template-Image
|
5 |
-
- bounding box
|
6 |
-
- annotator
|
7 |
-
- annotate
|
8 |
-
- boxes
|
9 |
-
title: gradio_image_annotation V0.2.3
|
10 |
-
colorFrom: yellow
|
11 |
-
colorTo: green
|
12 |
-
sdk: docker
|
13 |
-
pinned: false
|
14 |
-
license: apache-2.0
|
15 |
-
short_description: A Gradio component for image annotation
|
16 |
-
---
|
17 |
-
|
18 |
|
19 |
# `gradio_image_annotation`
|
20 |
<a href="https://pypi.org/project/gradio_image_annotation/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_image_annotation"></a>
|
21 |
|
22 |
A Gradio component that can be used to annotate images with bounding boxes.
|
23 |
|
|
|
|
|
24 |
## Installation
|
25 |
|
26 |
```bash
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
2 |
# `gradio_image_annotation`
|
3 |
<a href="https://pypi.org/project/gradio_image_annotation/" target="_blank"><img alt="PyPI - Version" src="https://img.shields.io/pypi/v/gradio_image_annotation"></a>
|
4 |
|
5 |
A Gradio component that can be used to annotate images with bounding boxes.
|
6 |
|
7 |
+
![Demo preview](images/demo.png)
|
8 |
+
|
9 |
## Installation
|
10 |
|
11 |
```bash
|
src/README.md
CHANGED
@@ -4,6 +4,8 @@
|
|
4 |
|
5 |
A Gradio component that can be used to annotate images with bounding boxes.
|
6 |
|
|
|
|
|
7 |
## Installation
|
8 |
|
9 |
```bash
|
|
|
4 |
|
5 |
A Gradio component that can be used to annotate images with bounding boxes.
|
6 |
|
7 |
+
![Demo preview](images/demo.png)
|
8 |
+
|
9 |
## Installation
|
10 |
|
11 |
```bash
|
src/backend/gradio_image_annotation/templates/component/index.js
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
src/frontend/shared/Canvas.svelte
CHANGED
@@ -217,7 +217,6 @@
|
|
217 |
box.startCreating(event, rect.left, rect.top);
|
218 |
if (singleBox) {
|
219 |
value.boxes = [box];
|
220 |
-
setDragMode();
|
221 |
} else {
|
222 |
value.boxes = [box, ...value.boxes];
|
223 |
}
|
@@ -240,8 +239,13 @@
|
|
240 |
if (selectedBox >= 0 && selectedBox < value.boxes.length) {
|
241 |
if (value.boxes[selectedBox].getArea() < 1) {
|
242 |
onDeleteBox();
|
243 |
-
} else
|
244 |
-
|
|
|
|
|
|
|
|
|
|
|
245 |
}
|
246 |
}
|
247 |
}
|
|
|
217 |
box.startCreating(event, rect.left, rect.top);
|
218 |
if (singleBox) {
|
219 |
value.boxes = [box];
|
|
|
220 |
} else {
|
221 |
value.boxes = [box, ...value.boxes];
|
222 |
}
|
|
|
239 |
if (selectedBox >= 0 && selectedBox < value.boxes.length) {
|
240 |
if (value.boxes[selectedBox].getArea() < 1) {
|
241 |
onDeleteBox();
|
242 |
+
} else {
|
243 |
+
if (!disableEditBoxes) {
|
244 |
+
newModalVisible = true;
|
245 |
+
}
|
246 |
+
if (singleBox) {
|
247 |
+
setDragMode();
|
248 |
+
}
|
249 |
}
|
250 |
}
|
251 |
}
|
src/frontend/shared/ImageAnnotator.svelte
CHANGED
@@ -50,12 +50,6 @@
|
|
50 |
dispatch("upload");
|
51 |
}
|
52 |
|
53 |
-
function handle_clear(): void {
|
54 |
-
clear();
|
55 |
-
dispatch("clear");
|
56 |
-
dispatch("change");
|
57 |
-
}
|
58 |
-
|
59 |
async function handle_save(img_blob: Blob | any): Promise<void> {
|
60 |
const f = await upload.load_files([new File([img_blob], `webcam.png`)]);
|
61 |
const image = f?.[0] || null;
|
@@ -101,6 +95,8 @@
|
|
101 |
|
102 |
function clear() {
|
103 |
value = null;
|
|
|
|
|
104 |
}
|
105 |
</script>
|
106 |
|
@@ -196,7 +192,7 @@
|
|
196 |
<SelectSource
|
197 |
{sources}
|
198 |
bind:active_source
|
199 |
-
{
|
200 |
handle_select={handle_select_source}
|
201 |
/>
|
202 |
{/if}
|
|
|
50 |
dispatch("upload");
|
51 |
}
|
52 |
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
async function handle_save(img_blob: Blob | any): Promise<void> {
|
54 |
const f = await upload.load_files([new File([img_blob], `webcam.png`)]);
|
55 |
const image = f?.[0] || null;
|
|
|
95 |
|
96 |
function clear() {
|
97 |
value = null;
|
98 |
+
dispatch("clear");
|
99 |
+
dispatch("change");
|
100 |
}
|
101 |
</script>
|
102 |
|
|
|
192 |
<SelectSource
|
193 |
{sources}
|
194 |
bind:active_source
|
195 |
+
handle_clear={clear}
|
196 |
handle_select={handle_select_source}
|
197 |
/>
|
198 |
{/if}
|
src/images/demo.png
ADDED
Git LFS Details
|
src/pyproject.toml
CHANGED
@@ -8,7 +8,7 @@ build-backend = "hatchling.build"
|
|
8 |
|
9 |
[project]
|
10 |
name = "gradio_image_annotation"
|
11 |
-
version = "0.2.
|
12 |
description = "A Gradio component that can be used to annotate images with bounding boxes."
|
13 |
readme = "README.md"
|
14 |
license = "MIT"
|
|
|
8 |
|
9 |
[project]
|
10 |
name = "gradio_image_annotation"
|
11 |
+
version = "0.2.4"
|
12 |
description = "A Gradio component that can be used to annotate images with bounding boxes."
|
13 |
readme = "README.md"
|
14 |
license = "MIT"
|