Spaces:
Runtime error
A newer version of the Gradio SDK is available: 6.12.0
π§ AuditAI β Enhanced Agentic AI Website Auditor (Gradio Edition)
An Agentic AI-powered web application built with Gradio that provides comprehensive website audits including SEO, performance, accessibility, security, mobile responsiveness, and broken link detection with AI-generated insights and PDF reports.
π What's New in Gradio Edition
Enhanced Features:
- β Accessibility Checker - WCAG 2.1 compliance analysis
- β Mobile Responsiveness Analyzer - Viewport, responsive images, touch targets
- β Broken Link Detection - Parallel link checking with detailed reports
- β PDF Report Generation - Professional downloadable audit reports
- β Historical Tracking - Track score improvements over time
- β Trend Analysis - Visualize performance changes across audits
- β Enhanced UI - Modern Gradio tabbed interface with better UX
Original Features (Retained):
- π Website scanning (load time, HTTPS, page size, links, headings)
- π€ Agentic AI analysis with Google Gemini 1.5 Flash
- π Interactive visualizations (gauges, radar charts, bar charts)
- β¬οΈ Downloadable optimized HTML
- π‘ AI-powered suggestions and fix snippets
π Quick Start
1οΈβ£ Install Dependencies
pip install -r requirements.txt
2οΈβ£ Set Up Gemini API Key
Create a .env file in the project root:
GEMINI_API_KEY=your_gemini_api_key_here
3οΈβ£ Run the Gradio App
python app_gradio.py
The app will launch at http://localhost:7860 with a shareable link.
4οΈβ£ Run the Original Streamlit App (Optional)
streamlit run app.py
π New Features Details
βΏ Accessibility Checker (accessibility_checker.py)
Analyzes WCAG 2.1 compliance:
- Missing alt text on images
- Proper heading hierarchy (H1-H6)
- Form labels and ARIA landmarks
- Link text quality
- Language attributes
- Skip navigation links
- Video captions
π± Mobile Responsiveness (mobile_checker.py)
Checks mobile-friendliness:
- Viewport meta tag validation
- Responsive images (srcset/sizes)
- Page size optimization for mobile
- Flash content detection
- Fixed-width elements
- Touch target sizes
- Media queries analysis
- Relative font sizing
π Broken Link Detector (link_checker.py)
Identifies broken links:
- Parallel processing for speed (10 concurrent workers)
- Checks up to 50 links per audit
- HTTP status code validation
- Internal vs external link tracking
- Detailed error reporting
π PDF Report Generator (report_generator.py)
Creates professional reports:
- Multi-page comprehensive audit summary
- Color-coded scores and metrics
- All detected issues organized by category
- AI recommendations
- Broken link details
- Timestamp and metadata
π Historical Tracking (history_tracker.py)
Tracks performance over time:
- JSON-based storage (last 100 audits)
- Per-site history retrieval
- Trend data for visualizations
- Score comparison across audits
π¨ Gradio UI Structure
The new interface uses 5 tabs:
- π Overview - Summary, scores, gauge & radar charts
- π Metrics & Trends - Technical metrics and historical trends
- β οΈ Issues - AI, accessibility, mobile, and broken link issues
- β Recommendations - AI-powered suggestions
- π PDF Report - Download comprehensive report
π Scoring System
Overall Score Calculation (0-100)
Based on:
- HTTPS (15 points)
- Load time (5-15 points)
- Title presence (10 points)
- Meta description (10 points)
- H1 tags (5-10 points)
- Images with alt text (up to 10 points)
- Links & scripts (up to 10 points)
- Paragraph content (up to 10 points)
- HTTP status (10 points)
Individual Scores
- SEO Score:
100 - (images_without_alt Γ 5) - Performance Score:
100 - (load_time Γ 10) - Accessibility Score: WCAG compliance based (0-100)
- Security Score: 100 if HTTPS, else 50
- Mobile Score: Mobile-friendliness based (0-100)
π§ Tech Stack
Core Technologies
- Python 3.9+
- Gradio 4.x β Modern web UI framework
- Google Gemini API β Gemini 1.5 Flash for AI analysis
- BeautifulSoup4 β HTML parsing
- Requests β HTTP client
Visualization & Reports
- Plotly β Interactive charts (gauges, radar, bar)
- Matplotlib β Word clouds
- Pandas β Data manipulation
- FPDF β PDF generation
Other
- python-dotenv β Environment variables
- concurrent.futures β Parallel link checking
π Project Structure
AuditAI-main/
βββ app.py # Original Streamlit app
βββ app_gradio.py # NEW: Gradio app
βββ scanner.py # Website scanner
βββ ai_analyzer.py # OpenAI integration
βββ scoring.py # Score calculation
βββ dashboard.py # Streamlit dashboard
βββ utils.py # Utility functions
βββ accessibility_checker.py # NEW: Accessibility analysis
βββ mobile_checker.py # NEW: Mobile responsiveness
βββ link_checker.py # NEW: Broken link detection
βββ report_generator.py # NEW: PDF generation
βββ history_tracker.py # NEW: Historical tracking
βββ requirements.txt # Dependencies
βββ README.md # Original readme
βββ README_GRADIO.md # This file
βββ .env # API keys (create this)
π― Usage Guide
- Enter URL: Input the website URL (e.g.,
https://example.com) - Choose Options: Check/uncheck "Check for Broken Links" (optional, slower)
- Click Audit: Start the comprehensive analysis
- View Results:
- Overview tab shows summary and scores
- Issues tab lists all detected problems
- Recommendations tab shows AI suggestions
- PDF tab provides downloadable report
- Track Progress: Re-audit the same site to see trend improvements
β‘ Performance Notes
- Broken Link Checking: Uses parallel processing (10 workers) but can take 30-60s for 50 links
- AI Analysis: Powered by Google Gemini AI | Enhanced with Advanced Analytics
- PDF Generation: Instant (<1s)
- Historical Trends: Only show after 2+ audits of the same site
π Environment Variables
Required in .env file:
GEMINI_API_KEY=your-gemini-key-here
π Gradio vs Streamlit
Why Gradio?
- β Easier deployment (built-in sharing)
- β Better tab organization
- β Cleaner API for complex workflows
- β Automatic shareable links
- β Better mobile experience
Keeping Streamlit?
Both versions are maintained. Use:
app_gradio.pyfor the enhanced versionapp.pyfor the original Streamlit version
π¨βπ» Author
Mirza Yasir Abdullah Baig
π License
Educational purposes. Not for commercial use without permission.
π Troubleshooting
Issue: Gemini API errors
Solution: Check your API key in .env and get it from https://aistudio.google.com/app/apikey
Issue: Broken link checking takes too long
Solution: Uncheck the "Check for Broken Links" option
Issue: PDF generation fails
Solution: Ensure fpdf is installed: pip install fpdf
Issue: No trend data shown
Solution: Audit the same site multiple times to build history
π Future Enhancements
- Multi-page website crawling
- Competitor comparison
- Lighthouse integration
- Email report scheduling
- Database storage (replace JSON)
- Custom scoring weights
- Screenshot capture
- Security header analysis
πΈ Screenshots
Coming soon! Run the app to see the beautiful new Gradio interface.
Enjoy auditing! π