A factory-dashboard application for metal surface defect localization and technician-ready quality diagnosis. The system combines a PyTorch/YOLO-style detector, an OpenAI-compatible LLM report generator, and a Streamlit web interface.
data/ Dataset scripts and processing utilities
models/ Deep learning architecture and optional weights
defect_detector.py
llm/ Prompt templates and OpenAI-compatible API client
report_generator.py
app.py Streamlit dashboard
requirements.txt Python dependencies
run.bat Windows one-click launcher
run.sh Linux/macOS one-click launcher
- Safe CUDA initialization with automatic CPU fallback.
- YOLOv8-compatible inference path when local weights are available.
- Deterministic mock inference when weights are missing, returning high-confidence metal-surface defects.
- OpenAI-compatible LLM API integration through
LLM_API_KEY,LLM_BASE_URL, andLLM_MODEL. - Factory-dashboard style Streamlit interface with upload, bounding-box visualization, metrics, and quality report output.
run.batchmod +x run.sh
./run.shBoth launchers create .venv, install dependencies from requirements.txt, and start:
streamlit run app.pySet these environment variables before launch if you want live LLM reports:
export LLM_API_KEY="your-api-key"
export LLM_BASE_URL="https://your-openai-compatible-endpoint/v1"
export LLM_MODEL="your-model-name"If no API key is configured, the application uses an offline industrial quality report template.
Place trained YOLO weights at:
models/weights/best.pt
If weights are unavailable or fail to load, the detector automatically uses mock mode so the application remains runnable for demos and grading.