Skip to content

Commit fdffd1a

Browse files
committed
feat: make Vision-only the default, Florence-2 opt-in via --florence
1 parent 54140db commit fdffd1a

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

tests/test_filter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ def test_filter_stats_in_timing(tmp_path):
181181
mock_vision.return_value = (mock_vision_dets, {})
182182
from uitag.run import run_pipeline
183183

184-
result, annotated, manifest = run_pipeline(str(img_path), backend=mock_backend)
184+
result, annotated, manifest = run_pipeline(
185+
str(img_path), backend=mock_backend, no_florence=False
186+
)
185187

186188
assert "florence2_filter_ms" in result.timing_ms
187189
assert result.timing_ms["florence2_total"] == 1

uitag/batch_cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,9 @@ def batch_main(argv: list[str] | None = None) -> None:
100100
help="Detection backend",
101101
)
102102
parser.add_argument(
103-
"--no-florence",
103+
"--florence",
104104
action="store_true",
105-
help="Skip Florence-2 detection (Vision-only mode, saves ~3s)",
105+
help="Enable Florence-2 detection (slower, adds ~1.5s — off by default)",
106106
)
107107

108108
args = parser.parse_args(argv)
@@ -133,7 +133,7 @@ def batch_main(argv: list[str] | None = None) -> None:
133133
ocr_mode = "fast" if args.fast else "fine"
134134
ocr_recognition = "fast" if args.fast else "accurate"
135135

136-
if args.no_florence:
136+
if not args.florence:
137137
backend = None
138138
source_label = (
139139
args.path[0].rstrip("/")
@@ -171,7 +171,7 @@ def batch_main(argv: list[str] | None = None) -> None:
171171
str(img_path),
172172
recognition_level=ocr_recognition,
173173
backend=backend,
174-
no_florence=args.no_florence,
174+
no_florence=not args.florence,
175175
)
176176
elapsed = time.perf_counter() - t0
177177

uitag/cli.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def main():
6464
help="Detection backend: auto (default, uses MLX), coreml (ANE offload), mlx",
6565
)
6666
parser.add_argument(
67-
"--no-florence",
67+
"--florence",
6868
action="store_true",
69-
help="Skip Florence-2 detection (Vision-only mode, saves ~3s)",
69+
help="Enable Florence-2 detection (slower, adds ~1.5s — off by default)",
7070
)
7171
parser.add_argument(
7272
"--verbose", "-v", action="store_true", help="Show element list and timing"
@@ -99,7 +99,7 @@ def main():
9999
out_dir = Path(args.output_dir)
100100
out_dir.mkdir(parents=True, exist_ok=True)
101101

102-
if args.no_florence:
102+
if not args.florence:
103103
backend = None
104104
ocr_mode = "fast" if args.fast else "fine"
105105
img_parent = str(Path(image_path).parent)
@@ -140,7 +140,7 @@ def main():
140140
rescan=bool(args.rescan),
141141
rescan_threshold=0.8,
142142
rescan_ids=rescan_ids,
143-
no_florence=args.no_florence,
143+
no_florence=not args.florence,
144144
)
145145

146146
total_ms = (time.perf_counter() - t0) * 1000
@@ -215,7 +215,7 @@ def main():
215215
backend=backend,
216216
rescan=True,
217217
rescan_threshold=0.8,
218-
no_florence=args.no_florence,
218+
no_florence=not args.florence,
219219
)
220220
rescan_s = time.perf_counter() - t0_rescan
221221

@@ -238,7 +238,7 @@ def main():
238238
if args.verbose:
239239
print(f"\nTiming: {json.dumps(result.timing_ms)}")
240240
# Florence-2 filter summary
241-
if args.no_florence:
241+
if not args.florence:
242242
print("Florence-2: skipped")
243243
elif "florence2_total" in result.timing_ms:
244244
total = result.timing_ms["florence2_total"]

uitag/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def run_pipeline(
2525
rescan: bool = False,
2626
rescan_threshold: float = 0.8,
2727
rescan_ids: list[int] | None = None,
28-
no_florence: bool = False,
28+
no_florence: bool = True,
2929
) -> tuple[PipelineResult, Image.Image, str]:
3030
"""Run the full detection pipeline on a screenshot.
3131

0 commit comments

Comments
 (0)