Skip to content

Commit 0d763ee

Browse files
committed
black and isort
1 parent 2c3fa2e commit 0d763ee

File tree

9 files changed

+28
-19
lines changed

9 files changed

+28
-19
lines changed

tests/tools/test_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from PIL import Image
77

88
from vision_agent.tools import TOOLS, Tool, register_tool
9-
from vision_agent.tools.tools import BboxIoU, BoxDistance, SegArea, SegIoU, MaskDistance
9+
from vision_agent.tools.tools import BboxIoU, BoxDistance, MaskDistance, SegArea, SegIoU
1010

1111

1212
def test_bbox_iou():

vision_agent/agent/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .agent import Agent
22
from .agent_coder import AgentCoder
3+
from .automated_vision_agent import AutomatedVisionAgent
34
from .easytool import EasyTool
45
from .reflexion import Reflexion
56
from .vision_agent import VisionAgent
6-
from .automated_vision_agent import AutomatedVisionAgent

vision_agent/agent/agent_coder.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
from .agent_coder_prompts import DEBUG, FIX_BUG, PROGRAM, TEST, VISUAL_TEST
1515

16-
1716
IMPORT_HELPER = """
1817
import math
1918
import re

vision_agent/agent/automated_vision_agent.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,13 @@ def write_plan(
4848
return plan["plan"]
4949

5050

51-
def write_code(user_req: str, subtask: str, tool_info: str, code: str, model: LLM) -> str:
51+
def write_code(
52+
user_req: str, subtask: str, tool_info: str, code: str, model: LLM
53+
) -> str:
5254
prompt = CODE.format(
53-
context=USER_REQ_SUBTASK_CONTEXT.format(user_requirement=user_req, subtask=subtask),
55+
context=USER_REQ_SUBTASK_CONTEXT.format(
56+
user_requirement=user_req, subtask=subtask
57+
),
5458
tool_info=tool_info,
5559
code=code,
5660
)
@@ -62,9 +66,13 @@ def write_code(user_req: str, subtask: str, tool_info: str, code: str, model: LL
6266
return extract_code(code)
6367

6468

65-
def write_test(user_req: str, subtask: str, tool_info: str, code: str, model: LLM) -> str:
69+
def write_test(
70+
user_req: str, subtask: str, tool_info: str, code: str, model: LLM
71+
) -> str:
6672
prompt = TEST.format(
67-
context=USER_REQ_SUBTASK_CONTEXT.format(user_requirement=user_req, subtask=subtask),
73+
context=USER_REQ_SUBTASK_CONTEXT.format(
74+
user_requirement=user_req, subtask=subtask
75+
),
6876
tool_info=tool_info,
6977
code=code,
7078
)
@@ -164,7 +172,9 @@ def run_plan(
164172
f"""
165173
{tabulate(tabular_data=[task], headers="keys", tablefmt="mixed_grid", maxcolwidths=_MAX_TABULATE_COL_WIDTH)}"""
166174
)
167-
tool_info = "\n".join([e["doc"] for e in tool_recommender.top_k(task["instruction"])])
175+
tool_info = "\n".join(
176+
[e["doc"] for e in tool_recommender.top_k(task["instruction"])]
177+
)
168178
success, code, result, task_memory = write_and_exec_code(
169179
user_req,
170180
task["instruction"],

vision_agent/agent/vision_agent.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
from PIL import Image
99
from tabulate import tabulate
1010

11+
from vision_agent.llm import LLM, OpenAILLM
12+
from vision_agent.lmm import LMM, OpenAILMM
13+
from vision_agent.tools import TOOLS
1114
from vision_agent.utils.image_utils import (
1215
convert_to_b64,
1316
overlay_bboxes,
1417
overlay_heat_map,
1518
overlay_masks,
1619
)
17-
from vision_agent.llm import LLM, OpenAILLM
18-
from vision_agent.lmm import LMM, OpenAILMM
19-
from vision_agent.tools import TOOLS
2020

2121
from .agent import Agent
2222
from .easytool_prompts import (

vision_agent/tools/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
TOOLS,
66
BboxArea,
77
BboxIoU,
8-
ObjectDistance,
98
BoxDistance,
10-
MaskDistance,
119
Crop,
1210
DINOv,
1311
ExtractFrames,
1412
GroundingDINO,
1513
GroundingSAM,
1614
ImageCaption,
1715
ImageQuestionAnswering,
16+
MaskDistance,
17+
ObjectDistance,
1818
SegArea,
1919
SegIoU,
2020
Tool,

vision_agent/tools/tools.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
from PIL.Image import Image as ImageType
1212
from scipy.spatial import distance # type: ignore
1313

14+
from vision_agent.lmm import OpenAILMM
15+
from vision_agent.tools.tool_utils import _send_inference_request
16+
from vision_agent.utils import extract_frames_from_video
1417
from vision_agent.utils.image_utils import (
1518
b64_to_pil,
1619
convert_to_b64,
@@ -19,9 +22,6 @@
1922
normalize_bbox,
2023
rle_decode,
2124
)
22-
from vision_agent.lmm import OpenAILMM
23-
from vision_agent.tools.tool_utils import _send_inference_request
24-
from vision_agent.utils import extract_frames_from_video
2525

2626
_LOGGER = logging.getLogger(__name__)
2727

vision_agent/tools/tools_v2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
import tempfile
44
from importlib import resources
55
from pathlib import Path
6-
from typing import Any, Callable, Dict, List, Union, Tuple
6+
from typing import Any, Callable, Dict, List, Tuple, Union
77

88
import numpy as np
99
import pandas as pd
1010
import requests
1111
from PIL import Image, ImageDraw, ImageFont
1212

13-
from vision_agent.utils.image_utils import convert_to_b64, normalize_bbox, rle_decode
1413
from vision_agent.tools.tool_utils import _send_inference_request
1514
from vision_agent.utils import extract_frames_from_video
15+
from vision_agent.utils.image_utils import convert_to_b64, normalize_bbox, rle_decode
1616

1717
COLORS = [
1818
(158, 218, 229),

vision_agent/utils/sim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from pathlib import Path
2-
from typing import List, Optional, Sequence, Union, Dict
2+
from typing import Dict, List, Optional, Sequence, Union
33

44
import pandas as pd
55
from openai import Client

0 commit comments

Comments
 (0)