Pierre Chapuis commited on
Commit
217e57c
1 Parent(s): eadfab2

fix clear in bbox tab

Browse files

see https://github.com/edgarGracia/gradio_image_annotator/pull/13

gradio_image_annotation-0.2.3-py3-none-any.whl ADDED
Binary file (85.3 kB). View file
 
pyproject.toml CHANGED
@@ -7,7 +7,8 @@ authors = [
7
  ]
8
  dependencies = [
9
  "gradio>=4.42.0",
10
- "gradio-image-annotation>=0.2.3",
 
11
  "pillow>=10.4.0",
12
  "pillow-heif>=0.18.0",
13
  "refiners @ git+https://github.com/finegrain-ai/refiners",
@@ -16,7 +17,6 @@ dependencies = [
16
  "transformers>=4.44.2",
17
  "spaces>=0.29.3",
18
  "numpy<2.0.0",
19
- "gradio-imageslider @ https://fg-cwl-public.s3.eu-west-1.amazonaws.com/9zlqqobl/gradio_imageslider-0.0.20-py3-none-any.whl",
20
  ]
21
  readme = "README.md"
22
  requires-python = ">= 3.12, <3.13"
 
7
  ]
8
  dependencies = [
9
  "gradio>=4.42.0",
10
+ "gradio-image-annotation @ https://huggingface.co/spaces/finegrain/finegrain-object-cutter/resolve/main/gradio_image_annotation-0.2.3-py3-none-any.whl",
11
+ "gradio-imageslider @ https://huggingface.co/spaces/finegrain/finegrain-object-cutter/resolve/main/gradio_imageslider-0.0.20-py3-none-any.whl",
12
  "pillow>=10.4.0",
13
  "pillow-heif>=0.18.0",
14
  "refiners @ git+https://github.com/finegrain-ai/refiners",
 
17
  "transformers>=4.44.2",
18
  "spaces>=0.29.3",
19
  "numpy<2.0.0",
 
20
  ]
21
  readme = "README.md"
22
  requires-python = ">= 3.12, <3.13"
requirements.lock CHANGED
@@ -20,7 +20,7 @@ anyio==4.4.0
20
  # via starlette
21
  build==1.2.1
22
  # via gradio-imageslider
23
- certifi==2024.7.4
24
  # via httpcore
25
  # via httpx
26
  # via requests
@@ -55,9 +55,9 @@ gradio==4.42.0
55
  # via spaces
56
  gradio-client==1.3.0
57
  # via gradio
58
- gradio-image-annotation==0.2.3
59
  # via cutter
60
- gradio-imageslider @ https://fg-cwl-public.s3.eu-west-1.amazonaws.com/9zlqqobl/gradio_imageslider-0.0.20-py3-none-any.whl
61
  # via cutter
62
  h11==0.14.0
63
  # via httpcore
@@ -79,7 +79,7 @@ idna==3.8
79
  # via requests
80
  importlib-resources==6.4.4
81
  # via gradio
82
- jaxtyping==0.2.33
83
  # via refiners
84
  jinja2==3.1.4
85
  # via gradio
@@ -138,7 +138,7 @@ nvidia-cusparse-cu12==12.1.0.106
138
  # via torch
139
  nvidia-nccl-cu12==2.20.5
140
  # via torch
141
- nvidia-nvjitlink-cu12==12.6.20
142
  # via nvidia-cusolver-cu12
143
  # via nvidia-cusparse-cu12
144
  nvidia-nvtx-cu12==12.1.105
@@ -195,7 +195,7 @@ pyyaml==6.0.2
195
  # via gradio
196
  # via huggingface-hub
197
  # via transformers
198
- refiners @ git+https://github.com/finegrain-ai/refiners@7ca1774b5f8f172708db647a26c3be68858f285a
199
  # via cutter
200
  regex==2024.7.24
201
  # via transformers
@@ -205,7 +205,7 @@ requests==2.32.3
205
  # via transformers
206
  rich==13.8.0
207
  # via typer
208
- ruff==0.6.2
209
  # via gradio
210
  safetensors==0.4.4
211
  # via refiners
@@ -214,7 +214,7 @@ scipy==1.14.1
214
  # via pymatting
215
  semantic-version==2.10.0
216
  # via gradio
217
- setuptools==74.0.0
218
  # via torch
219
  shellingham==1.5.4
220
  # via typer
@@ -223,9 +223,9 @@ six==1.16.0
223
  sniffio==1.3.1
224
  # via anyio
225
  # via httpx
226
- spaces==0.29.3
227
  # via cutter
228
- starlette==0.38.2
229
  # via fastapi
230
  sympy==1.13.2
231
  # via torch
 
20
  # via starlette
21
  build==1.2.1
22
  # via gradio-imageslider
23
+ certifi==2024.8.30
24
  # via httpcore
25
  # via httpx
26
  # via requests
 
55
  # via spaces
56
  gradio-client==1.3.0
57
  # via gradio
58
+ gradio-image-annotation @ https://huggingface.co/spaces/finegrain/finegrain-object-cutter/resolve/main/gradio_image_annotation-0.2.3-py3-none-any.whl
59
  # via cutter
60
+ gradio-imageslider @ https://huggingface.co/spaces/finegrain/finegrain-object-cutter/resolve/main/gradio_imageslider-0.0.20-py3-none-any.whl
61
  # via cutter
62
  h11==0.14.0
63
  # via httpcore
 
79
  # via requests
80
  importlib-resources==6.4.4
81
  # via gradio
82
+ jaxtyping==0.2.34
83
  # via refiners
84
  jinja2==3.1.4
85
  # via gradio
 
138
  # via torch
139
  nvidia-nccl-cu12==2.20.5
140
  # via torch
141
+ nvidia-nvjitlink-cu12==12.6.68
142
  # via nvidia-cusolver-cu12
143
  # via nvidia-cusparse-cu12
144
  nvidia-nvtx-cu12==12.1.105
 
195
  # via gradio
196
  # via huggingface-hub
197
  # via transformers
198
+ refiners @ git+https://github.com/finegrain-ai/refiners@a8efe5eab0505886411b6a7abf4927d4be6fcc0b
199
  # via cutter
200
  regex==2024.7.24
201
  # via transformers
 
205
  # via transformers
206
  rich==13.8.0
207
  # via typer
208
+ ruff==0.6.3
209
  # via gradio
210
  safetensors==0.4.4
211
  # via refiners
 
214
  # via pymatting
215
  semantic-version==2.10.0
216
  # via gradio
217
+ setuptools==74.1.0
218
  # via torch
219
  shellingham==1.5.4
220
  # via typer
 
223
  sniffio==1.3.1
224
  # via anyio
225
  # via httpx
226
+ spaces==0.29.6
227
  # via cutter
228
+ starlette==0.38.4
229
  # via fastapi
230
  sympy==1.13.2
231
  # via torch
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- gradio_image_annotation==0.2.3
2
  https://huggingface.co/spaces/finegrain/finegrain-object-cutter/resolve/main/gradio_imageslider-0.0.20-py3-none-any.whl
3
  pillow>=10.4.0
4
  pillow-heif>=0.18.0
 
1
+ https://huggingface.co/spaces/finegrain/finegrain-object-cutter/resolve/main/gradio_image_annotation-0.2.3-py3-none-any.whl
2
  https://huggingface.co/spaces/finegrain/finegrain-object-cutter/resolve/main/gradio_imageslider-0.0.20-py3-none-any.whl
3
  pillow>=10.4.0
4
  pillow-heif>=0.18.0
src/app.py CHANGED
@@ -165,6 +165,10 @@ def process_bbox(prompts: dict[str, Any]) -> tuple[tuple[Image.Image, Image.Imag
165
  return _process(img, bbox)
166
 
167
 
 
 
 
 
168
  def process_prompt(img: Image.Image, prompt: str) -> tuple[tuple[Image.Image, Image.Image], gr.DownloadButton]:
169
  return _process(img, prompt)
170
 
@@ -300,7 +304,8 @@ with gr.Blocks() as demo:
300
  btn.add(oimg)
301
 
302
  annotator.change(
303
- fn=lambda: gr.update(interactive=True),
 
304
  outputs=[btn],
305
  )
306
  btn.click(
 
165
  return _process(img, bbox)
166
 
167
 
168
+ def on_change_bbox(prompts: dict[str, Any] | None):
169
+ return gr.update(interactive=prompts is not None)
170
+
171
+
172
  def process_prompt(img: Image.Image, prompt: str) -> tuple[tuple[Image.Image, Image.Image], gr.DownloadButton]:
173
  return _process(img, prompt)
174
 
 
304
  btn.add(oimg)
305
 
306
  annotator.change(
307
+ fn=on_change_bbox,
308
+ inputs=[annotator],
309
  outputs=[btn],
310
  )
311
  btn.click(