Build from Source#

This section shows how to build the Smart Traffic Intersection Agent from source to customize or extend its functionality.

Prerequisites#

  • System Requirements: Verify that your system meets the minimum requirements.

  • Docker platform: Install Docker platform from Get Docker.

  • Basic familiarity with Git and Docker commands.

Build Traffic Intersection Agent#

1. Clone the Repository#

git clone https://github.com/open-edge-platform/edge-ai-suites.git
cd edge-ai-suites/metro-ai-suite/smart-traffic-intersection-agent/

2. Set the required environment variables#

export VLM_MODEL_NAME=<supported_model_name>  # eg. microsoft/Phi-3.5-vision-instruct, Qwen/Qwen2.5-VL-3B-Instruct

IMPORTANT: See this disclaimer before using any AI Model.

3. Build the Docker Image#

Build the Traffic Intersection Agent:

docker compose -f docker/agent-compose.yaml build traffic-agent

4. Run the Service#

# Using setup script (recommended)
source setup.sh --run

# Or manually with Docker Compose
docker compose -f docker/agent-compose.yaml up traffic-agent

4. Verify the Build#

# Check service health
curl http://localhost:8081/health

# Access UI
curl http://localhost:7860/

# View logs
docker compose -f docker/agent-compose.yaml logs traffic-agent

Verify API Endpoints#

# Health check
curl http://localhost:8081/health

# Get current traffic data
curl http://localhost:8081/api/v1/traffic/current

Rebuild After Changes#

After you have edited the code, rebuild:

# Rebuild the image
docker compose -f docker/agent-compose.yaml build traffic-agent

# Restart the service
docker compose -f docker/agent-compose.yaml up -d traffic-agent

# View startup logs
docker compose -f docker/agent-compose.yaml logs traffic-agent

Learn More#