vision-agent 0.2.146__py3-none-any.whl → 0.2.147__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -643,7 +643,23 @@ def use_object_detection_fine_tuning(
643
643
  return output_str
644
644
 
645
645
  code = artifacts[name]
646
- patterns = [
646
+
647
+ patterns_with_fine_tune_id = [
648
+ (
649
+ r'florence2_phrase_grounding\(\s*"([^"]+)"\s*,\s*([^,]+)(?:,\s*"[^"]+")?\s*\)',
650
+ lambda match: f'florence2_phrase_grounding("{match.group(1)}", {match.group(2)}, "{fine_tune_id}")',
651
+ ),
652
+ (
653
+ r'owl_v2_image\(\s*"([^"]+)"\s*,\s*([^,]+)(?:,\s*"[^"]+")?\s*\)',
654
+ lambda match: f'owl_v2_image("{match.group(1)}", {match.group(2)}, "{fine_tune_id}")',
655
+ ),
656
+ (
657
+ r'florence2_sam2_image\(\s*"([^"]+)"\s*,\s*([^,]+)(?:,\s*"[^"]+")?\s*\)',
658
+ lambda match: f'florence2_sam2_image("{match.group(1)}", {match.group(2)}, "{fine_tune_id}")',
659
+ ),
660
+ ]
661
+
662
+ patterns_without_fine_tune_id = [
647
663
  (
648
664
  r"florence2_phrase_grounding\(\s*([^\)]+)\s*\)",
649
665
  lambda match: f'florence2_phrase_grounding({match.group(1)}, "{fine_tune_id}")',
@@ -659,8 +675,21 @@ def use_object_detection_fine_tuning(
659
675
  ]
660
676
 
661
677
  new_code = code
662
- for pattern, replacer in patterns:
663
- new_code = re.sub(pattern, replacer, new_code)
678
+
679
+ for index, (pattern_with_fine_tune_id, replacer_with_fine_tune_id) in enumerate(
680
+ patterns_with_fine_tune_id
681
+ ):
682
+ if re.search(pattern_with_fine_tune_id, new_code):
683
+ new_code = re.sub(
684
+ pattern_with_fine_tune_id, replacer_with_fine_tune_id, new_code
685
+ )
686
+ else:
687
+ (pattern_without_fine_tune_id, replacer_without_fine_tune_id) = (
688
+ patterns_without_fine_tune_id[index]
689
+ )
690
+ new_code = re.sub(
691
+ pattern_without_fine_tune_id, replacer_without_fine_tune_id, new_code
692
+ )
664
693
 
665
694
  if new_code == code:
666
695
  output_str = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vision-agent
3
- Version: 0.2.146
3
+ Version: 0.2.147
4
4
  Summary: Toolset for Vision Agent
5
5
  Author: Landing AI
6
6
  Author-email: dev@landing.ai
@@ -15,7 +15,7 @@ vision_agent/lmm/__init__.py,sha256=jyY1sJb_tYKg5-Wzs3p1lvwFkc-aUNZfMcLy3TOC4Zg,
15
15
  vision_agent/lmm/lmm.py,sha256=B5ClgwvbybVCWkf9opDMLjTtJZemUU4KUkQoRxGh43I,16787
16
16
  vision_agent/lmm/types.py,sha256=ZEXR_ptBL0ZwDMTDYkgxUCmSZFmBYPQd2jreNzr_8UY,221
17
17
  vision_agent/tools/__init__.py,sha256=zUv3aVPN1MXfyQiQi5To4rkQGtG7mxLQ1NjLI3pxM80,2412
18
- vision_agent/tools/meta_tools.py,sha256=iHvMeBktWcVi-0DOrSMak1gsZrM_VKJlAq1mAFbBemE,23477
18
+ vision_agent/tools/meta_tools.py,sha256=skY4nHSH7PFXNBAEKGYI6XZskv8zJ2UX1KbMY2gd_bo,24687
19
19
  vision_agent/tools/prompts.py,sha256=V1z4YJLXZuUl_iZ5rY0M5hHc_2tmMEUKr0WocXKGt4E,1430
20
20
  vision_agent/tools/tool_utils.py,sha256=5ukuDMxbEH4iKetYR9I7twzsA8ECyP4tVwYXQq54mxI,8020
21
21
  vision_agent/tools/tools.py,sha256=c7SjtZD7YfxhEAGYYe-ExVCBA4NDXmRwerBIbd-XEH8,74557
@@ -27,7 +27,7 @@ vision_agent/utils/image_utils.py,sha256=rm9GfXvD4JrjnqKrP_f2gfq4SzmqYC0IdC1kKwd
27
27
  vision_agent/utils/sim.py,sha256=ebE9Cs00pVEDI1HMjAzUBk88tQQmc2U-yAzIDinnekU,5572
28
28
  vision_agent/utils/type_defs.py,sha256=BE12s3JNQy36QvauXHjwyeffVh5enfcvd4vTzSwvEZI,1384
29
29
  vision_agent/utils/video.py,sha256=xbMEoRk13l4fHeQlbvMQhLCn8RNndYmsDhUf01TUeR8,4781
30
- vision_agent-0.2.146.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
31
- vision_agent-0.2.146.dist-info/METADATA,sha256=0xtIEPRJgc8ifV8z9C6OoLyi9w7wqQV7mpUmrWsLSVM,13758
32
- vision_agent-0.2.146.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
33
- vision_agent-0.2.146.dist-info/RECORD,,
30
+ vision_agent-0.2.147.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
31
+ vision_agent-0.2.147.dist-info/METADATA,sha256=juNWGPjUPW3pxyGKPEBV_CwDllMnTj8B6c9Z7hevCyM,13758
32
+ vision_agent-0.2.147.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
33
+ vision_agent-0.2.147.dist-info/RECORD,,