TrafficJamAnalyzer is an advanced tool designed to help monitor and analyze traffic conditions by processing images from CCTV cameras around the roads of Tenerife. By utilizing artificial intelligence (AI) with Semantic Kernel and OpenAI, the application accurately assesses traffic density and identifies locations with potential traffic jams.
Before installing TrafficJamAnalyzer, ensure your system meets the following requirements:
Follow these steps to install TrafficJamAnalyzer:
Clone the Repository:
git clone https://github.com/emimontesdeoca/TrafficJamAnalyzer.git
cd TrafficJamAnalyzerSet Up the Environment: Ensure .NET 8 SDK is installed on your machine. Download it here.
Install Dependencies: Install the necessary packages using NuGet Package Manager:
dotnet restoreConfigure AI Integration:
AiApiService.Build the Application:
dotnet buildRun the Application:
dotnet runThe project is structured as follows:
C:DEVELOPMENTSPEAKSAITRAFFICJAMANALYZER
├───TrafficJamAnalyzer.ApiService
├───TrafficJamAnalyzer.AppHost
├───TrafficJamAnalyzer.ServiceDefaults
├───TrafficJamAnalyzer.Services.AiApiService
├───TrafficJamAnalyzer.Services.ScraperApiService
├───TrafficJamAnalyzer.Services.TrafficService
├───TrafficJamAnalyzer.Shared.Clients
├───TrafficJamAnalyzer.Shared.Models
├───TrafficJamAnalyzer.Web
└───TrafficJamAnalyzer.Workers.Analyzer
Edit the appsettings.json file in the TrafficJamAnalyzer.Services.AiApiService project to include your OpenAI API integration settings:
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*",
"OpenAI": {
"Endpoint": "",
"DeploymentName": "",
"ApiKey": "",
"Prompt": "The image I'm going to provide you is an image from a CCTV that shows a road, I need you to give me a JSON object with 'Title'' which is title in the top left and 'Traffic' which is an integer from 0 to 100 which shows the amount of traffic jam and the 'Date' that is on the bottom right, please only provide the JSON result and nothing else. Return only the json object without any markdown. If you a lot of lanes, please focus on the one that is busy when checking for the traffic, so, if you see 4 lanes and only 2 are full, it means that the traffic is jammed."
}
}Launch the Application: Start the application via the command line or your chosen IDE.
Configure Settings:
appsettings.json.Start Analysis: Begin the real-time traffic analysis to monitor and evaluate traffic conditions.
Review Results: Traffic conditions will be displayed on the dashboard, highlighting areas with potential traffic jams.
We welcome contributions to TrafficJamAnalyzer!
git checkout -b feature/your-feature-namegit commit -m 'Add some feature'git push origin feature/your-feature-nameDistributed under the MIT License. See LICENSE for more information.
Thank you for using TrafficJamAnalyzer! We hope it helps you keep the roads of Tenerife traffic-free.