An intelligent AI tool that detects common Python bugs and suggests fixes using machine learning and pattern matching.
- AI-Powered Analysis: Combines ML with rule-based corrections
- Real-Time Feedback: Instant bug detection as you type
- Educational: Explains why changes are needed
- Production-Ready: Clean Gradio interface with system monitoring
-
Run locally:
git clone https://github.com/punisher-303/Python-Code-Inspector.git cd Python-Code-Inspector pip install -r requirements.txt python app.py 🛠️ How It Works
Code Tokenization: Custom parser breaks down Python syntax
Feature Extraction: TF-IDF with n-grams (1-4) captures patterns
ML Classification: Random Forest predicts bug probability
Smart Corrections: Rule-based fixes with context
def add(a, b): return a - b # Detected (98% confidence)
def add(a, b): return a + b
💡 Key Features Feature Description 20+ Bug Patterns Wrong operators, missing colons, unsafe code Confidence Scoring Visual 0-100% confidence indicator Detailed Analysis JSON output with technical details System Monitoring CPU/RAM usage tracking 📊 Model Performance Accuracy: 92.5% (cross-validated)
Inference Speed: <100ms
Training Data: 200 curated examples
Vocabulary Size: 500 tokens
🛠️ Development
pip install -r requirements.txt
python train.py
python -m pytest tests/
🤝 Contributing Found a bug we missed?
Fork the repository
Add your test case to train.py
Submit a pull request
📜 License MIT License - See LICENSE for details.
👨💻 Team Punisher-303
Add Teammates
