diff --git a/main.py b/main.py index d1b7800..2879b10 100644 --- a/main.py +++ b/main.py @@ -88,15 +88,64 @@ def api_info(): 'endpoints': { '/': 'GET - Frontend interface or API information', '/api': 'GET - API information (JSON)', + '/docs': 'GET - API documentation (Swagger UI)', '/detect': 'POST - Upload image for memory module detection', '/detect/hardcoded': 'GET - Process hardcoded test image', '/detect/base64': 'POST - Process base64 encoded image', '/health': 'GET - Health check' }, 'model_loaded': detector.model is not None, - 'supported_formats': list(ALLOWED_EXTENSIONS) + 'supported_formats': list(ALLOWED_EXTENSIONS), + 'swagger_ui': 'http://localhost:5003/docs/ (run: python3 api_docs.py)' }) +@app.route('/docs') +def api_docs(): + """Redirect to API documentation.""" + return """ + + + + API Documentation + + + +
+

🚀 Memory Module Detection API Documentation

+

Interactive Swagger UI documentation for all API endpoints

+ +

📖 Access Swagger UI:

+
+ Step 1: Start API docs server
+ python3 api_docs.py

+ Step 2: Open Swagger UI
+ http://localhost:5003/docs/ +
+ + + 📚 Open Swagger UI (if running) + + +

📋 Quick API Reference:

+ + +

← Back to Main Interface

+
+ + + """ + @app.route('/health', methods=['GET']) def health_check(): """Health check endpoint.""" diff --git a/templates/index.html b/templates/index.html index 9607cd5..1fbdb2c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -39,6 +39,9 @@ + + API Documentation +