Skip to content

shraddhagreddy/Auto_comment_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Auto-Comment Generator using AI - project

An AI-powered tool that generates meaningful comments for code snippets written in Python, C++, and Java. It comes with:

  1. A Flask backend API for programmatic access.
  2. A Streamlit frontend UI for an interactive experience.

Features

  1. Generate comments for Python, C++ and Java code.
  2. Simple REST API endpoints.
  3. Clean Streamlit interface with Lottie animations.
  4. Modular code structure for easy extension.

πŸ“‚ Project Structure Auto_Comments-main β”œβ”€β”€ routes β”‚ β”œβ”€β”€ cpp_route.py β”‚ β”œβ”€β”€ java_route.py β”‚ β”œβ”€β”€ main_route.py β”‚ └── python_route.py β”œβ”€β”€ src β”‚ β”œβ”€β”€ cpp β”‚ β”œβ”€β”€ java β”‚ └── python β”œβ”€β”€ static β”‚ └── type_lottie.json β”œβ”€β”€ LICENSE β”œβ”€β”€ README.md β”œβ”€β”€ app.py # Streamlit UI β”œβ”€β”€ requirements.txt β”œβ”€β”€ server.py # Flask API server

βš™οΈ Installation

  1. Clone the repository: git clone https://github.com/your-username/auto-comments.git cd auto-comments

  2. Create and activate a virtual environment: python -m venv venv source venv/bin/activate # Mac/Linux venv\Scripts\activate # Windows

  3. Install dependencies: pip install -r requirements.txt

▢️ Usage Option 1 – Run Streamlit UI streamlit run app.py Open in browser: http://localhost:8501 Paste your code. Select language (Python / C++ / Java). Click Generate Comments.

Option 2 – Run Flask API python server.py Server runs at: http://127.0.0.1:5000

Available endpoints: /python β†’ Generate comments for Python code /cpp β†’ Generate comments for C++ code /java β†’ Generate comments for Java code

πŸ“Œ Example (API) POST β†’ /python { "code_snippet": "def add(a, b): return a + b" }

Response:

Function to add two numbers

def add(a, b): return a + b

🎨 UI Preview Landing page shows an animation when no language is selected. Paste your code in the text area. Get instant AI-generated comments.

πŸ› οΈ Tech Stack Backend: Flask Frontend: Streamlit + Lottie animations Languages Supported: Python, C++, Java

About

🌟 AI Comment Generator | Python β€’ C++ β€’ Java | Flask API + Streamlit UI

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages