Commit Β·
925a61b
1
Parent(s): bf9b8fe
changes in Readme.md
Browse files
README.md
CHANGED
|
@@ -1,17 +1,35 @@
|
|
| 1 |
-
#
|
| 2 |
|
| 3 |
An RedAI-powered code review tool using OpenAI GPT models to analyze and improve your code quality.
|
|
|
|
| 4 |
|
| 5 |
-
## Features
|
| 6 |
|
| 7 |
-
|
| 8 |
-
- π **Bug Detection** - Identify potential bugs and issues
|
| 9 |
-
- β‘ **Optimization Suggestions** - Get performance improvement tips
|
| 10 |
-
- π **Security Review** - Detect security vulnerabilities
|
| 11 |
-
- π **Code Refactoring** - Receive improved code versions
|
| 12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
## Installation
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
|
| 17 |
Load and use directly from Hugging Face Hub!
|
|
@@ -19,24 +37,42 @@ Load and use directly from Hugging Face Hub!
|
|
| 19 |
## Quick Start
|
| 20 |
|
| 21 |
```python
|
| 22 |
-
from huggingface_hub import
|
| 23 |
-
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
| 26 |
-
os.environ["OPENAI_API_KEY"] = "your-openai-api-key"
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
|
|
|
|
| 30 |
|
| 31 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
code = """
|
| 33 |
-
def
|
| 34 |
if n == 0:
|
| 35 |
return 1
|
| 36 |
else:
|
| 37 |
-
return n *
|
| 38 |
"""
|
| 39 |
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Red AI Code Reviewer
|
| 2 |
|
| 3 |
An RedAI-powered code review tool using OpenAI GPT models to analyze and improve your code quality.
|
| 4 |
+
developed by Ranajit Sahoo (Software developer at **Redintegro** ).
|
| 5 |
|
|
|
|
| 6 |
|
| 7 |
+
#### click https://huggingface.co/Ranajit1997/red-ai-code-reviewer/tree/main on this link to check the code
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
+
## β¨ Features
|
| 10 |
+
π€ **AI-Powered Analysis** - Uses OpenAI's advanced language models for comprehensive code review
|
| 11 |
+
|
| 12 |
+
π **Multi-dimensional Review** - Evaluates readability, bugs, optimizations, security, and more
|
| 13 |
+
|
| 14 |
+
π **Code Refactoring** - Suggests improved code versions with detailed explanations
|
| 15 |
+
|
| 16 |
+
π― **Overall Scoring** - Provides quantitative score (0-100) for code quality assessment
|
| 17 |
+
|
| 18 |
+
π **Easy Integration** - Simple Python API for quick implementation
|
| 19 |
+
|
| 20 |
+
π **Security Scanning** - Identifies potential security vulnerabilities
|
| 21 |
+
|
| 22 |
+
β‘ **Performance Optimization** - Suggests performance improvements
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
## Installation
|
| 28 |
## Installation
|
| 29 |
|
| 30 |
+
```bash
|
| 31 |
+
# Install required dependencies
|
| 32 |
+
pip install huggingface_hub openai
|
| 33 |
|
| 34 |
|
| 35 |
Load and use directly from Hugging Face Hub!
|
|
|
|
| 37 |
## Quick Start
|
| 38 |
|
| 39 |
```python
|
| 40 |
+
from huggingface_hub import snapshot_download
|
| 41 |
+
import sys, os
|
| 42 |
+
|
| 43 |
+
# Set OpenAI key (if not set in terminal)
|
| 44 |
+
os.environ["OPENAI_API_KEY"] = "sk-your-openai-key-here"
|
| 45 |
+
|
| 46 |
+
# Download repo from Hugging Face
|
| 47 |
+
repo_dir = snapshot_download("Ranajit1997/red-ai-code-reviewer")
|
| 48 |
+
|
| 49 |
+
# Add repo folder to Python path
|
| 50 |
+
package_dir = os.path.join(repo_dir, "red_ai_code_reviewer") # folder with model.py, pipeline.py, __init__.py
|
| 51 |
|
| 52 |
+
sys.path.append(package_dir)
|
|
|
|
| 53 |
|
| 54 |
+
# 4οΈβ£ Import classes directly from files
|
| 55 |
+
from model import CodeReviewerModel
|
| 56 |
+
from pipeline import CodeReviewerPipeline
|
| 57 |
|
| 58 |
+
# 5οΈβ£ Initialize
|
| 59 |
+
model = CodeReviewerModel(api_key="sk-your-openai-key-here",
|
| 60 |
+
)
|
| 61 |
+
reviewer = CodeReviewerPipeline(model)
|
| 62 |
+
|
| 63 |
+
# 6οΈβ£ Example code
|
| 64 |
code = """
|
| 65 |
+
def factorial(n):
|
| 66 |
if n == 0:
|
| 67 |
return 1
|
| 68 |
else:
|
| 69 |
+
return n * factorial(n-1)
|
| 70 |
"""
|
| 71 |
|
| 72 |
+
# 7οΈβ£ Run review
|
| 73 |
+
review = reviewer(code)
|
| 74 |
+
|
| 75 |
+
# 8οΈβ£ Print result
|
| 76 |
+
print("AI Review:\n", review)
|
| 77 |
+
|
| 78 |
+
|