https://github.com/monarch1108/ai_code_reviewer
GenAI - AI Code Reviewer analyzes Python code using Gemini AI, detects bugs, suggests fixes, and provides improved code snippets via Streamlit.
https://github.com/monarch1108/ai_code_reviewer
gemini-api generative-ai streamlit
Last synced: about 2 months ago
JSON representation
GenAI - AI Code Reviewer analyzes Python code using Gemini AI, detects bugs, suggests fixes, and provides improved code snippets via Streamlit.
- Host: GitHub
- URL: https://github.com/monarch1108/ai_code_reviewer
- Owner: MONARCH1108
- License: mit
- Created: 2025-02-20T11:38:08.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-20T11:39:02.000Z (over 1 year ago)
- Last Synced: 2025-02-20T12:31:02.114Z (over 1 year ago)
- Topics: gemini-api, generative-ai, streamlit
- Language: Python
- Homepage:
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ๐ง AI Code Reviewer
A web-based AI-powered tool that reviews Python code, detects bugs, suggests improvements, and generates human-friendly documentation using language models.
---
### Documentation : https://medium.com/@abhayemani8/ai-code-reviewer-documentation-0a17280adcfd

## ๐ Overview
This project demonstrates the evolution of a code reviewer app through two versions:
- **Version 1**: Built with guidance from ChatGPT and tutorials. It uses Google's Gemini API and Streamlit for quick prototyping.
- **Version 2**: Fully self-written using Flask and a local Ollama LLM (`llama3.2`) for offline, more customizable AI processing.
---
## ๐งพ Table of Contents
- [Project Structure](#file-structure)
- [Version Highlights](#version-highlights)
- [Tech Stack](#tech-stack)
- [Setup & Installation](#setup--installation)
- [How to Run](#how-to-run)
- [Learnings & Evolution](#learnings--evolution)
- [Screenshots](#screenshots) *(optional)*
- [License](#license)
---
## ๐ File Structure
```bash
.
โโโ version_1/ # Streamlit + Gemini API version
โ โโโ app.py
โ โโโ .env (Google API key)
โ
โโโ version_2/ # Flask + Ollama + Llama3.2 version
โ โโโ app.py
โ โโโ templates/
โ โ โโโ index.html
โ โโโ utils/
โ โโโ functions.py
โ
โโโ README.md
โโโ requirements.txt # Optional, depending on environment
```
## โจ Version Highlights
### ๐น Version 1 (Assisted Build)
- Built using **Streamlit** for fast UI.
- Uses **Google Gemini API** via `google.generativeai`.
- Offers simple input/output layout for quick feedback.
### ๐ธ Version 2 (Self-Built)
- Built using **Flask** from scratch.
- Implements **Ollama** with a **locally running `llama3.2` model**.
- Enhanced prompt engineering for better review quality.
- Beautiful **custom HTML/CSS UI** for better user experience.
- Contains robust instructions for context filtering (code-only reviews).
|Area|Tools Used|
|---|---|
|Frontend|Streamlit (v1), HTML/CSS (v2)|
|Backend|Python, Flask|
|LLM|Google Gemini API (v1), Ollama LLM (`llama3.2`) (v2)|
|Environment|dotenv (`.env`), virtualenv|
## โ๏ธ Setup & Installation
### ๐งช Version 1
```bash
cd version_1
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install streamlit google.generativeai
```
# Set your Google API Key in .env
```bash
echo GOOGLE_API_KEY=your_key_here > .env
streamlit run app.py
```
### ๐ ๏ธ Version 2
```bash
cd version_2
python -m venv venv
source venv/bin/activate
pip install flask ollama
# Make sure Ollama is installed and running
ollama run llama3.2
python app.py
```
## ๐ง Learnings & Evolution
### Version 1
- taught me the basics of API calls, prompt structuring, and how to quickly prototype with Streamlit.
### Version 2
- was my full-stack build using Flask, local LLMs, and custom UI โ improving my understanding of backend routing, HTML templating, and deploying AI models locally.
- Implemented stricter prompt rules and better error handling in v2.