A simple web tool that leverages the power of the Google Gemini API to analyze any code snippet. It automatically detects the programming language, determines the Time and Space Complexity (Big O notation), and provides a concise explanation.
- 🤖 AI-Powered Analysis: Uses Google Gemini for accurate code inspection.
- 🌐 Language Auto-Detection: Automatically identifies the programming language of the snippet.
- ⏱️ Time & Space Complexity: Calculates Big O notation for both time and space efficiency.
- 💡 Clear Explanations: Provides simple, AI-generated explanations for the analysis.
- 🌙 Modern & Responsive UI: Sleek, dark-themed interface built with Tailwind CSS that works on all screen sizes.
- Frontend: HTML5, CSS3, JavaScript (ES6+)
- Styling: Tailwind CSS
- AI Model: Google Gemini API
To get a local copy up and running, follow these simple steps.
You will need a Google Gemini API key to use this application.
- Get an API key at Google AI Studio.
-
Clone the repository to your local machine:
git clone [https://github.com/your-username/ai-code-analyzer.git](https://github.com/your-username/ai-code-analyzer.git)
(Replace
your-usernamewith your actual GitHub username) -
Navigate to the project directory:
cd ai-code-analyzer -
Add your API Key:
- Open the
script.jsfile in a text editor. - Find the following line:
const API_KEY = "YOUR_API_KEY";
- Replace
"YOUR_API_KEY"with your actual Google Gemini API key.
- Open the
-
Run the application:
- Simply open the
index.htmlfile in your favorite web browser.
- Simply open the
- Open the
index.htmlfile in your browser. - Paste any code snippet into the text area.
- Click the "Analyze Complexity" button.
- View the results that appear below, including the detected language, time complexity, space complexity, and the AI's explanation.
This project is licensed under the MIT License.