Spaces:
Sleeping
A newer version of the Gradio SDK is available:
6.3.0
π Quick Start Guide - Vehicle Diagnostics Agent
β Current Status
The system is fully operational!
- β
Conda environment:
vda(active) - β Dataset: Generated (50,000 records)
- β Model: Trained (99.53% accuracy)
- β All agents: Implemented and tested
- β Gradio UI: Running at http://localhost:7860
- β Tests: All 12 tests passing
π― Access the System
Gradio UI (Currently Running)
URL: http://localhost:7860
The Gradio interface is already running in your cascade terminal!
Features:
- π Single vehicle diagnostics
- π Vehicle overview with anomaly list
- π Full diagnostic reports
- π Interactive visualizations
π§ Running Different Components
1. Gradio UI (Interactive Dashboard)
# If not already running:
python src/ui/gradio_app.py
# Or use the quick start script:
./run_ui.sh
2. FastAPI Backend (REST API)
# Start the API server:
uvicorn src.api.main:app --host 0.0.0.0 --port 8000 --reload
# Or use the quick start script:
./run_api.sh
API Endpoints:
http://localhost:8000- Roothttp://localhost:8000/docs- Interactive API documentationhttp://localhost:8000/health- Health checkhttp://localhost:8000/vehicles- List vehicleshttp://localhost:8000/diagnose- Run diagnostic
3. Python Script (Direct)
# Run the demo script:
python demo.py
# Or test the orchestrator:
python src/orchestrator.py
4. Docker (Production Deployment)
# Build and run with Docker Compose:
docker-compose up --build
# Access:
# - API: http://localhost:8000
# - UI: http://localhost:7860
π Quick Examples
Example 1: Using Gradio UI
- Open http://localhost:7860 in your browser
- Go to "Single Vehicle Diagnostic" tab
- Select a vehicle ID from the dropdown
- Set number of readings (e.g., 200)
- Click "Run Diagnostic"
- View results, visualizations, and full report
Example 2: Using Python API
from src.orchestrator import VehicleDiagnosticOrchestrator
# Initialize
orchestrator = VehicleDiagnosticOrchestrator()
# Run diagnostic
result = orchestrator.diagnose_vehicle(vehicle_id=32, n_readings=200)
# Access results
if result['success']:
print(result['report']['natural_language_summary'])
print(f"Anomaly Score: {result['anomaly_result']['overall_score']}")
Example 3: Using REST API
# Health check
curl http://localhost:8000/health
# List vehicles
curl http://localhost:8000/vehicles
# Run diagnostic
curl -X POST http://localhost:8000/diagnose \
-H "Content-Type: application/json" \
-d '{"vehicle_id": 32, "n_readings": 200}'
# Get full report
curl http://localhost:8000/report/32
π§ͺ Testing
# Run all tests:
pytest tests/ -v
# Run specific test:
pytest tests/test_agents.py::TestDataIngestionAgent -v
# Run with coverage:
pytest tests/ --cov=src --cov-report=html
Current Test Results:
- β 12/12 tests passing
- β Execution time: ~3.24 seconds
- β 100% success rate
π Sample Vehicles to Try
Based on the test data, here are some interesting vehicles:
Vehicles with Anomalies:
- Vehicle 32: High anomaly rate (~75%), cooling system issues
- Vehicle 8: Medium anomaly rate, multiple sensor issues
- Vehicle 15: Low anomaly rate, tire pressure issues
Healthy Vehicles:
- Vehicle 1: No anomalies detected
- Vehicle 2: Clean sensor readings
- Vehicle 5: Normal operation
π¨ Gradio UI Features
Tab 1: Single Vehicle Diagnostic
- Select vehicle from dropdown
- Set number of readings to analyze
- View real-time diagnostic results
- See anomaly detection visualization
- Read natural language summary
- Access full technical report
Tab 2: Vehicle Overview
- List all vehicles with anomalies
- See anomaly counts and rates
- Refresh list dynamically
Tab 3: About
- System architecture
- Technology stack
- Feature list
- Dataset information
π Important Files
Data Files
data/raw/vehicle_sensor_data.csv- Raw sensor datadata/processed/train.csv- Training datadata/processed/test.csv- Test datadata/processed/scaler.pkl- Feature scaler
Model Files
src/models/best_anomaly_detector.pth- Trained LSTM model
Configuration
requirements.txt- Python dependenciesdocker-compose.yml- Docker configuration.gitignore- Git ignore rules
Documentation
README.md- Comprehensive documentationPROJECT_SUMMARY.md- Project completion summaryQUICK_START.md- This file
π Troubleshooting
Issue: Gradio UI not loading
Solution: Check if the UI is already running in another terminal. Only one instance can run on port 7860.
Issue: Model not found error
Solution: Train the model first:
python src/models/train_anomaly_detector.py
Issue: Data not found error
Solution: Generate and preprocess data:
python src/utils/download_data.py
python src/utils/data_preprocessing.py
Issue: Import errors
Solution: Make sure vda conda environment is activated:
conda activate vda
Issue: Port already in use
Solution: Change the port or stop the existing process:
# For Gradio (default 7860):
python src/ui/gradio_app.py # Will auto-select next available port
# For FastAPI (default 8000):
uvicorn src.api.main:app --port 8001
π― Next Steps
- Explore the Gradio UI - Try diagnosing different vehicles
- Test the API - Use the FastAPI docs at
/docs - Run the demo - Execute
python demo.py - Customize - Modify agents for your use case
- Deploy - Use Docker for production deployment
π Support
For issues or questions:
- Check
README.mdfor detailed documentation - Review
PROJECT_SUMMARY.mdfor project overview - Examine test files in
tests/for usage examples
π Success!
Your Vehicle Diagnostics Agent is fully operational and ready to use!
Current Status:
- β System: Running
- β UI: http://localhost:7860
- β Model: Trained (99.53% accuracy)
- β Data: Processed (50,000 records)
- β Tests: Passing (12/12)
Enjoy your multi-agent AI diagnostic system! πβ¨