Skip to content

punisher-303/Python-Code-Inspector

Repository files navigation

🐞 Python Code Inspector - AI Bug Detection Tool

GitHub Hugging Face License: MIT Python

An intelligent AI tool that detects common Python bugs and suggests fixes using machine learning and pattern matching.

Python Code Inspector Demo

🏆 Hackathon Features

  • 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

🚀 Quick Start

  1. Try the live demo: Open in Spaces

  2. 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
deepseek_mermaid_20250725_c708e6

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

Example Bug Detection

def add(a, b): return a - b # Detected (98% confidence)

Suggested Fix:

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

Install dependencies

pip install -r requirements.txt

Train new model

python train.py

Run tests

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

About

An AI-powered tool that detects common Python bugs and suggests fixes. its only for one hackathon not for pro

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages