Hugging Face Deployer commited on
Commit
a83e3a6
·
1 Parent(s): 9071215

Deploy explorer to Hugging Face Spaces

Browse files
Files changed (3) hide show
  1. evals/interactive_explorer.py +21 -2
  2. pyproject.toml +33 -1
  3. uv.lock +0 -0
evals/interactive_explorer.py CHANGED
@@ -1448,7 +1448,26 @@ Return a single JSON object containing:
1448
  client = OpenAI(api_key=api_key)
1449
 
1450
  def _judge(img_path: Path) -> dict:
1451
- b64 = base64.b64encode(img_path.read_bytes()).decode("utf-8")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1452
  response = client.chat.completions.create(
1453
  model="gpt-4o",
1454
  response_format={"type": "json_object"},
@@ -1461,7 +1480,7 @@ Return a single JSON object containing:
1461
  "role": "user",
1462
  "content": [
1463
  {"type": "text", "text": audit_prompt},
1464
- {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{b64}"}}
1465
  ]
1466
  }
1467
  ],
 
1448
  client = OpenAI(api_key=api_key)
1449
 
1450
  def _judge(img_path: Path) -> dict:
1451
+ from PIL import Image
1452
+ import io
1453
+
1454
+ # Open image using Pillow to normalize color space and remove transparency
1455
+ with Image.open(img_path) as img:
1456
+ # Create a solid white background image matching the size
1457
+ background = Image.new("RGB", img.size, (255, 255, 255))
1458
+
1459
+ # If the image has an alpha channel, use it as a mask when pasting
1460
+ if img.mode in ("RGBA", "LA") or (img.mode == "P" and "transparency" in img.info):
1461
+ background.paste(img, mask=img.convert("RGBA").split()[3])
1462
+ else:
1463
+ background.paste(img)
1464
+
1465
+ # Save the flattened RGB image as a JPEG to a byte buffer
1466
+ buffer = io.BytesIO()
1467
+ background.save(buffer, format="JPEG", quality=90)
1468
+ jpeg_bytes = buffer.getvalue()
1469
+
1470
+ b64 = base64.b64encode(jpeg_bytes).decode("utf-8")
1471
  response = client.chat.completions.create(
1472
  model="gpt-4o",
1473
  response_format={"type": "json_object"},
 
1480
  "role": "user",
1481
  "content": [
1482
  {"type": "text", "text": audit_prompt},
1483
+ {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64}"}}
1484
  ]
1485
  }
1486
  ],
pyproject.toml CHANGED
@@ -16,14 +16,23 @@ dependencies = [
16
  "pydantic-settings>=2.0.0",
17
  "python-dotenv>=1.0.0",
18
  "draco @ git+https://github.com/avsolatorio/draco2.git@data360-mcp",
 
 
19
  "pandas>=3.0.0",
20
  "cachetools>=6.2.4",
21
  "scikit-learn>=1.8.0",
 
 
 
22
  "vl-convert-python>=1.9.0.post1",
23
  "huggingface-hub",
24
- "openai",
25
  ]
26
 
 
 
 
 
27
  [build-system]
28
  requires = ["setuptools>=42", 'setuptools-scm']
29
  build-backend = "setuptools.build_meta"
@@ -34,6 +43,26 @@ where = ["src"]
34
  [tool.setuptools.package-data]
35
  data360 = ["tool_contract_version.json", "databases.json", "ref_area_groups.json"]
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  [tool.ruff.lint]
38
  select = ['I', 'UP', 'PL', 'F401']
39
 
@@ -42,6 +71,9 @@ name = "pypi"
42
  url = "https://pypi.org/simple"
43
  default = true
44
 
 
 
 
45
  [tool.pyright]
46
  typeCheckingMode = "standard"
47
  extraPaths = ["packages/data360-mcp-agent/src"]
 
16
  "pydantic-settings>=2.0.0",
17
  "python-dotenv>=1.0.0",
18
  "draco @ git+https://github.com/avsolatorio/draco2.git@data360-mcp",
19
+ "opencensus-ext-azure>=1.1.13",
20
+ "azure-monitor-opentelemetry>=1.6.0",
21
  "pandas>=3.0.0",
22
  "cachetools>=6.2.4",
23
  "scikit-learn>=1.8.0",
24
+ "opentelemetry-instrumentation-httpx>=0.50b0",
25
+ "opentelemetry-sdk>=1.28.0",
26
+ "opentelemetry-exporter-otlp>=1.28.0",
27
  "vl-convert-python>=1.9.0.post1",
28
  "huggingface-hub",
29
+ "Pillow>=10.0.0",
30
  ]
31
 
32
+ [project.optional-dependencies]
33
+ # LangChain / LangGraph client (workspace package); use: uv sync --extra agent
34
+ agent = ["data360-mcp-agent"]
35
+
36
  [build-system]
37
  requires = ["setuptools>=42", 'setuptools-scm']
38
  build-backend = "setuptools.build_meta"
 
43
  [tool.setuptools.package-data]
44
  data360 = ["tool_contract_version.json", "databases.json", "ref_area_groups.json"]
45
 
46
+ [tool.uv.workspace]
47
+ members = ["packages/data360-mcp-agent"]
48
+
49
+ [dependency-groups]
50
+ dev = [
51
+ "data360-mcp-agent",
52
+ "pre-commit>=4.5.0",
53
+ "pyright>=1.1.407",
54
+ "ruff>=0.14.8",
55
+ "poethepoet>=0.27.0",
56
+ "pytest>=8.0.0",
57
+ "pytest-asyncio>=0.23.0",
58
+ "pytest-httpx>=0.27.0",
59
+ "pytest-cov>=4.1.0",
60
+ "pip-licenses>=5.0.0",
61
+ "pip-audit>=2.10.0",
62
+ "requests>=2.32.0",
63
+ "deepeval>=4.1.0",
64
+ ]
65
+
66
  [tool.ruff.lint]
67
  select = ['I', 'UP', 'PL', 'F401']
68
 
 
71
  url = "https://pypi.org/simple"
72
  default = true
73
 
74
+ [tool.uv.sources]
75
+ data360-mcp-agent = { workspace = true }
76
+
77
  [tool.pyright]
78
  typeCheckingMode = "standard"
79
  extraPaths = ["packages/data360-mcp-agent/src"]
uv.lock CHANGED
The diff for this file is too large to render. See raw diff