Skip to content

Conversation

@ashwinvaidya17
Copy link
Contributor

@ashwinvaidya17 ashwinvaidya17 commented Nov 21, 2025

πŸ“ Description

  • Add CPU build

TODO

  • Add GPU build
  • Add XPU build

✨ Changes

Select what type of change your PR is:

  • πŸš€ New feature (non-breaking change which adds functionality)
  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • πŸ”„ Refactor (non-breaking change which refactors the code base)
  • ⚑ Performance improvements
  • 🎨 Style changes (code style/formatting)
  • πŸ§ͺ Tests (adding/modifying tests)
  • πŸ“š Documentation update
  • πŸ“¦ Build system changes
  • 🚧 CI/CD configuration
  • πŸ”§ Chore (general maintenance)
  • πŸ”’ Security update
  • πŸ’₯ Breaking change (fix or feature that would cause existing functionality to not work as expected)

βœ… Checklist

Before you submit your pull request, please make sure you have completed the following steps:

  • πŸ“š I have made the necessary updates to the documentation (if applicable).
  • πŸ§ͺ I have written tests that support my changes and prove that my fix is effective or my feature works (if applicable).
  • 🏷️ My PR title follows conventional commit format.

For more information about code review checklists, see the Code Review Checklist.

MarkRedeman and others added 30 commits October 8, 2025 13:52
* initial backend commit

Signed-off-by: Ma, Xiangxiang <[email protected]>

* app -> src

Signed-off-by: Ma, Xiangxiang <[email protected]>

* Remove empty file

Signed-off-by: Ma, Xiangxiang <[email protected]>

* move code

Signed-off-by: Ma, Xiangxiang <[email protected]>

* fix style backend

Signed-off-by: Ma, Xiangxiang <[email protected]>

* rename media endpoint

Signed-off-by: Ma, Xiangxiang <[email protected]>

---------

Signed-off-by: Ma, Xiangxiang <[email protected]>
These won't be needed yet
…tform#2948)

* Use src folder inside run.sh

* Set openapi_url path

* Update to react 19

* Specify bash language in readme
…edge-platform#2945)

* add training + inference endpoint

Signed-off-by: Ma, Xiangxiang <[email protected]>

* remove model api

Signed-off-by: Ma, Xiangxiang <[email protected]>

* cleanup code

Signed-off-by: Ma, Xiangxiang <[email protected]>

* update async execution

Signed-off-by: Ma, Xiangxiang <[email protected]>

* improve training worker loop and predict endpoint

Signed-off-by: Ma, Xiangxiang <[email protected]>

* fix style

Signed-off-by: Ma, Xiangxiang <[email protected]>

* fix style to use python3.10 generics

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add tests for services

Signed-off-by: Ma, Xiangxiang <[email protected]>

* style fix

Signed-off-by: Ma, Xiangxiang <[email protected]>

* style fix

Signed-off-by: Ma, Xiangxiang <[email protected]>

* style fix

Signed-off-by: Ma, Xiangxiang <[email protected]>

* style fix

Signed-off-by: Ma, Xiangxiang <[email protected]>

* style fix

Signed-off-by: Ma, Xiangxiang <[email protected]>

---------

Signed-off-by: Ma, Xiangxiang <[email protected]>
…edge-platform#2961)

* Add github actions for ui and server of geti inspect

* Exclude UI from pre-commit prettier configuration

The UI uses a different prettier configuration that does not seem to be
picked up by pre-commit.

* Add newline to .prettierignore

* Apply prettier to `geti-inspect.yaml`

* Generate OpenAPI spec before running UI checks

* Checkout with lfs

* Fix lint issues by removing wip components

* Try installing git lfs in the playwright docker image

* Fix unused noqa
…edge-platform#2963)

* Add OpenAPI route

* Remove MSW browser worker

* Rename infernece to inspect

* Update navbar title

* Rename infernece to inspect
* rename models/ to pydantic_models/

Signed-off-by: Ma, Xiangxiang <[email protected]>

* switch to use async session context manager

Signed-off-by: Ma, Xiangxiang <[email protected]>

* fix unit tests

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add pipeline endpoints

Signed-off-by: Ma, Xiangxiang <[email protected]>

* fix frame aquisition worker and rename pipiline endpoints

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add sources and sinks endpoints

Signed-off-by: Ma, Xiangxiang <[email protected]>

* stream loading working

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add webrtc endpoints

Signed-off-by: Ma, Xiangxiang <[email protected]>

* fix workers: stream loading + inference + dispatcher

Signed-off-by: Ma, Xiangxiang <[email protected]>

* fix sinks

Signed-off-by: Ma, Xiangxiang <[email protected]>

* style

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add unit tests and address comments

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add tests

Signed-off-by: Ma, Xiangxiang <[email protected]>

* fix example schema

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add todo

Signed-off-by: Ma, Xiangxiang <[email protected]>

---------

Signed-off-by: Ma, Xiangxiang <[email protected]>
…2970)

* chore: Add path alias to icons

* feat: Add sidebar with dataset, models and stats
* feat: Display placeholders for images

* refactor: Fix scrollbar

* chore: Remove learn more
* chore(inspect): Update UI scripts

* chore: Update github actions

* chore: Update port to 8000
* chore: Add project route

* feat: Add project management

* revert ui lock change

* chore: Remove not needed code for project management
… training progress (open-edge-platform#2984)

* feat: Allow user to upload images

* feat: List uploaded images

* chore: Extract components to separate files and add ready to train and training progress

* chore: comment thumbnail url generation
…en-edge-platform#2989)

* chore(inspect): Renamed app to application

* chore(inspect): Rename app to application in github actions
…of email (open-edge-platform#2990)

refactor: Update photo placeholder to use indicator instead of email
…dge-platform#2991)

Improve error and suspense handling in router

By moving all of the routes into a single root route we can make sure
that all routes are rendered inside of an layout that has a suspense and
error boundary.
πŸ› fix(inspect): Fix unable to start train job
* add trainable models endpoint

* fix

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add test

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add copyright

Signed-off-by: Ma, Xiangxiang <[email protected]>

---------

Signed-off-by: Ma, Xiangxiang <[email protected]>
…rm#3004)

* add thumbnails endpoint

Signed-off-by: Ma, Xiangxiang <[email protected]>

* add tests

Signed-off-by: Ma, Xiangxiang <[email protected]>

* generate thumbnails as background task

Signed-off-by: Ma, Xiangxiang <[email protected]>

* update docstring

Signed-off-by: Ma, Xiangxiang <[email protected]>

---------

Signed-off-by: Ma, Xiangxiang <[email protected]>
Copilot AI review requested due to automatic review settings December 1, 2025 13:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 29 changed files in this pull request and generated 2 comments.


πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"http://localhost:9000",
"http://127.0.0.1:9000",
],
allow_origins=["*"],
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing CORS from specific origins to allow all origins (*) introduces a security risk. This allows any website to make requests to your API. Consider using environment variables to configure allowed origins for different deployment environments, or maintain the original restrictive list for production.

Copilot uses AI. Check for mistakes.
rev: v2.12.0.2
hooks:
- id: hadolint
files: ^application/\.packaging/docker/ # TODO: this will break when the Dockerfile is moved
Copy link

Copilot AI Dec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TODO comment indicates technical debt. Consider using a more flexible file pattern (e.g., Dockerfile$ or **/*Dockerfile*) that won't break if the Dockerfile is moved, or create a tracking issue for this concern rather than leaving it as an inline TODO.

Suggested change
files: ^application/\.packaging/docker/ # TODO: this will break when the Dockerfile is moved
files: Dockerfile$|Dockerfile\..*$

Copilot uses AI. Check for mistakes.
"http://localhost:9000",
"http://127.0.0.1:9000",
],
allow_origins=["*"],

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: python.fastapi.security.wildcard-cors.wildcard-cors Warning

CORS policy allows any origin (using wildcard '*'). This is insecure and should be avoided.
WORKDIR /app

RUN --mount=type=cache,target=/home/non-root/.cache/uv,uid=10001,gid=10001 \
uv sync --frozen --no-dev --extra cpu --extra application
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why run uv sync from the root anomalib folder instead of application?

Installing inspect as an extra might be useful during development but I don't see the value in production environments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which pre-commit config did you run to result in all these style fixes? Using prek, ruff does not apply these changes.

Comment on lines 68 to 69
[tool.hatch.build.targets.wheel.sources]
"src" = ""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does "src" = "" do?

* Replace "pre-commit" with "prek" in both root and application/backend pyproject.toml files.
* Remove dependency for "geti-inspect" in the root pyproject.toml.

Signed-off-by: Ashwin Vaidya <[email protected]>
Signed-off-by: Ashwin Vaidya <[email protected]>
Signed-off-by: Ashwin Vaidya <[email protected]>
Signed-off-by: Ashwin Vaidya <[email protected]>
Signed-off-by: Ashwin Vaidya <[email protected]>
Copilot AI review requested due to automatic review settings December 3, 2025 13:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 13 changed files in this pull request and generated 3 comments.


πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

"http://localhost:9000",
"http://127.0.0.1:9000",
],
allow_origins=["*"],
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing all origins with allow_origins=['*'] creates a security vulnerability by permitting cross-origin requests from any domain. This bypasses CORS protection and could enable malicious sites to access the API. Restrict allow_origins to specific trusted domains or use environment variables to configure allowed origins.

Copilot uses AI. Check for mistakes.

```bash
cd application/.packaging/docker
AI_DEVICE=cuda docker compose up
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The device name 'cuda' is inconsistent with the docker-compose.yml and Dockerfile which use 'cu124'. Either update the example to use 'cu124' or ensure all references use 'cuda' consistently.

Suggested change
AI_DEVICE=cuda docker compose up
AI_DEVICE=cu124 docker compose up

Copilot uses AI. Check for mistakes.
"paho-mqtt~=2.1.0",
]

# Explicit versions are needed as we can't propogate extra dependencies to anomalib
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'propogate' to 'propagate'.

Suggested change
# Explicit versions are needed as we can't propogate extra dependencies to anomalib
# Explicit versions are needed as we can't propagate extra dependencies to anomalib

Copilot uses AI. Check for mistakes.
Signed-off-by: Ashwin Vaidya <[email protected]>
Signed-off-by: Ashwin Vaidya <[email protected]>
Signed-off-by: Ashwin Vaidya <[email protected]>
Copilot AI review requested due to automatic review settings December 3, 2025 13:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 13 changed files in this pull request and generated 1 comment.


πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +49 to +52
# Map all host devices to provide access to webcams and other attached devices
privileged: true
devices:
- /dev:/dev
Copy link

Copilot AI Dec 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running the container in privileged mode with full access to /dev is a significant security risk that grants the container nearly unrestricted access to the host system. Consider mapping only specific required devices (e.g., /dev/video0 for webcams) and removing privileged: true unless absolutely necessary for the application's core functionality.

Suggested change
# Map all host devices to provide access to webcams and other attached devices
privileged: true
devices:
- /dev:/dev
# Map only required host devices (e.g., webcam) to the container for security.
# privileged: true # Removed for security; only enable if absolutely necessary.
# devices:
# - /dev/video0:/dev/video0 # Example: map only webcam device if needed.

Copilot uses AI. Check for mistakes.
"http://localhost:9000",
"http://127.0.0.1:9000",
],
allow_origins=["*"],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Alembic
alembic_config_path: str = "src/alembic.ini"
alembic_script_location: str = "src/alembic"
alembic_config_path: str = str(_MODULE_DIR / "alembic.ini")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be adjusted further when we introduce Pyinstaller

@@ -0,0 +1,52 @@
# PID file in a location non-root user can write to
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we omit having nginx by serving UI static using FastAPI?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question: why put everything in a parent folder .packaging/?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move it into application/docker (without .packaging?) no need to hide it imho. This would also align well with the other applications.


EXPOSE 80

CMD ["sh", "-c", "nginx && exec uv run src/main.py"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use backend/run.sh?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add example of running the container with camera passthrough? I guess would be a common usecase

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to build it and it works. However, couldn't get camera passthrough to work on mac. Have you tested it on linux?

Copilot AI review requested due to automatic review settings December 6, 2025 05:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 14 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

application/docker/Dockerfile:1

  • The dockerfile path references application/.packaging/docker/Dockerfile, but based on the file structure, the Dockerfile is located at application/docker/Dockerfile. This mismatch will cause the build to fail.
#------------------------------------------

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

## To create CPU build

```bash
cd application/.packaging/docker
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The directory path in the instructions is incorrect. The actual docker files are in application/docker/, not application/.packaging/docker/. This inconsistency appears in all three build instruction sections and will cause users to encounter errors when following the documentation.

Copilot uses AI. Check for mistakes.


@webui_router.get("/", include_in_schema=False)
async def get_webui(full_path: str = "") -> FileResponse: # noqa: ARG001
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function parameter full_path is declared but never used, and there's no logic to prevent potential path traversal attacks or handle different routes. If this endpoint is meant to handle multiple paths, the implementation should use full_path to serve the appropriate files. If it only serves index.html, the parameter should be removed.

Suggested change
async def get_webui(full_path: str = "") -> FileResponse: # noqa: ARG001
async def get_webui() -> FileResponse:

Copilot uses AI. Check for mistakes.
@webui_router.get("/", include_in_schema=False)
async def get_webui(full_path: str = "") -> FileResponse: # noqa: ARG001
"""Get the webui index.html file."""
if settings.static_files_dir and not (file_path := Path(settings.static_files_dir) / "index.html").exists():
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If settings.static_files_dir is None or empty, file_path will not be defined, causing an UnboundLocalError on line 20. The condition should ensure file_path is always defined before the return statement, or raise an appropriate error when static_files_dir is not configured.

Suggested change
if settings.static_files_dir and not (file_path := Path(settings.static_files_dir) / "index.html").exists():
if not settings.static_files_dir:
raise HTTPException(status_code=500, detail="Static files directory is not configured")
file_path = Path(settings.static_files_dir) / "index.html"
if not file_path.exists():

Copilot uses AI. Check for mistakes.
"http://localhost:9000",
"http://127.0.0.1:9000",
],
allow_origins=["*"],
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allowing all origins with allow_origins=[\"*\"] is a security risk in production environments as it permits any domain to make requests to the API. Consider making this configurable through settings and restricting it to specific trusted origins in production.

Copilot uses AI. Check for mistakes.
Comment on lines +130 to +131
&& echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy unified" | \
tee /etc/apt/sources.list.d/intel-gpu-jammy.list \
Copy link

Copilot AI Dec 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The XPU build stage is adding Ubuntu 'jammy' repositories to a Debian-based image (python:3.13-slim is based on Debian). This repository mismatch may cause package installation issues or incompatibilities. Use the appropriate Debian-compatible Intel GPU repository instead.

Suggested change
&& echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy unified" | \
tee /etc/apt/sources.list.d/intel-gpu-jammy.list \
&& echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/debian bookworm unified" | \
tee /etc/apt/sources.list.d/intel-gpu-bookworm.list \

Copilot uses AI. Check for mistakes.
# Persist logs
- backend-logs:/app/logs
ports:
- "8000:8000"

Check warning

Code scanning / Semgrep OSS

Semgrep Finding: trailofbits.yaml.docker-compose.port-all-interfaces.port-all-interfaces Warning

Service port is exposed on all interfaces
Signed-off-by: Ashwin Vaidya <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants