Spaces:
Sleeping
Sleeping
Resolve merge conflicts and update configurations
Browse files- .gitattributes +35 -0
- .gitignore +2 -2
- Dockerfile +9 -8
- README.md +35 -12
- src/config.py +1 -1
.gitattributes
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
CHANGED
@@ -31,7 +31,6 @@ ENV/
|
|
31 |
*.swo
|
32 |
|
33 |
# Logs
|
34 |
-
logs/
|
35 |
*.log
|
36 |
|
37 |
# Local development
|
@@ -50,4 +49,5 @@ prometheus_data/
|
|
50 |
!requirements.txt
|
51 |
!src/
|
52 |
!Dockerfile
|
53 |
-
!README
|
|
|
|
31 |
*.swo
|
32 |
|
33 |
# Logs
|
|
|
34 |
*.log
|
35 |
|
36 |
# Local development
|
|
|
49 |
!requirements.txt
|
50 |
!src/
|
51 |
!Dockerfile
|
52 |
+
!README.md
|
53 |
+
!logs/
|
Dockerfile
CHANGED
@@ -18,6 +18,15 @@ RUN mkdir -p /app/logs /app/src/static /home/user/.cache/huggingface /home/user/
|
|
18 |
RUN useradd -m -u 1000 user \
|
19 |
&& chown -R user:user /app /home/user/.cache /home/user/.local
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
# Switch to non-root user
|
22 |
USER user
|
23 |
|
@@ -34,14 +43,6 @@ RUN pip install --user --no-cache-dir -r requirements.txt
|
|
34 |
# Copy application code
|
35 |
COPY --chown=user:user . .
|
36 |
|
37 |
-
# Set environment variables
|
38 |
-
ENV PYTHONPATH=/app
|
39 |
-
ENV PYTHONUNBUFFERED=1
|
40 |
-
ENV PYTHONDONTWRITEBYTECODE=1
|
41 |
-
ENV PORT=7860
|
42 |
-
ENV PATH="/home/user/.local/bin:${PATH}"
|
43 |
-
ENV HF_HOME=/home/user/.cache/huggingface
|
44 |
-
|
45 |
# Expose port for Hugging Face Spaces
|
46 |
EXPOSE 7860
|
47 |
|
|
|
18 |
RUN useradd -m -u 1000 user \
|
19 |
&& chown -R user:user /app /home/user/.cache /home/user/.local
|
20 |
|
21 |
+
# Set environment variables
|
22 |
+
ENV PYTHONPATH=/app
|
23 |
+
ENV PYTHONUNBUFFERED=1
|
24 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
25 |
+
ENV PORT=7860
|
26 |
+
ENV PATH="/home/user/.local/bin:${PATH}"
|
27 |
+
ENV HF_HOME=/home/user/.cache/huggingface
|
28 |
+
ENV TRANSFORMERS_CACHE=/home/user/.cache/huggingface
|
29 |
+
|
30 |
# Switch to non-root user
|
31 |
USER user
|
32 |
|
|
|
43 |
# Copy application code
|
44 |
COPY --chown=user:user . .
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
# Expose port for Hugging Face Spaces
|
47 |
EXPOSE 7860
|
48 |
|
README.md
CHANGED
@@ -1,14 +1,35 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
This is a FastAPI application that provides automated code reviews using the Gemma model. It's deployed on Hugging Face Spaces.
|
4 |
|
5 |
## Features
|
6 |
|
7 |
-
- Automated code review using Gemma model
|
8 |
- Support for multiple programming languages
|
9 |
- Real-time feedback
|
10 |
- Performance metrics tracking
|
11 |
- Review history
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
## Environment Variables
|
14 |
|
@@ -20,6 +41,18 @@ The following environment variables need to be set in your Hugging Face Space:
|
|
20 |
- `LOG_LEVEL`: INFO
|
21 |
- `PORT`: 7860
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
## Deployment Instructions
|
24 |
|
25 |
1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
|
@@ -34,13 +67,3 @@ The following environment variables need to be set in your Hugging Face Space:
|
|
34 |
- Rename `Dockerfile.huggingface` to `Dockerfile`
|
35 |
5. Set the environment variables in Space Settings
|
36 |
6. Deploy!
|
37 |
-
|
38 |
-
## Usage
|
39 |
-
|
40 |
-
Once deployed, you can access the application at:
|
41 |
-
`https://huggingface.co/spaces/[YOUR-USERNAME]/code-review-assistant`
|
42 |
-
|
43 |
-
## API Documentation
|
44 |
-
|
45 |
-
Access the API documentation at:
|
46 |
-
`https://huggingface.co/spaces/[YOUR-USERNAME]/code-review-assistant/docs`
|
|
|
1 |
+
---
|
2 |
+
title: Code Review Assistant
|
3 |
+
emoji: 🤖
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: green
|
6 |
+
sdk: docker
|
7 |
+
pinned: false
|
8 |
+
---
|
9 |
+
|
10 |
+
# Code Review Assistant
|
11 |
|
12 |
This is a FastAPI application that provides automated code reviews using the Gemma model. It's deployed on Hugging Face Spaces.
|
13 |
|
14 |
## Features
|
15 |
|
16 |
+
- Automated code review using Gemma-2b-it model
|
17 |
- Support for multiple programming languages
|
18 |
- Real-time feedback
|
19 |
- Performance metrics tracking
|
20 |
- Review history
|
21 |
+
- Code quality analysis
|
22 |
+
- Best practices recommendations
|
23 |
+
- Security checks
|
24 |
+
- Performance optimization suggestions
|
25 |
+
|
26 |
+
## Technology Stack
|
27 |
+
|
28 |
+
- FastAPI
|
29 |
+
- Hugging Face Transformers
|
30 |
+
- Docker
|
31 |
+
- PostgreSQL
|
32 |
+
- Prometheus
|
33 |
|
34 |
## Environment Variables
|
35 |
|
|
|
41 |
- `LOG_LEVEL`: INFO
|
42 |
- `PORT`: 7860
|
43 |
|
44 |
+
## Usage
|
45 |
+
|
46 |
+
1. Select your programming language
|
47 |
+
2. Paste your code
|
48 |
+
3. Click "Submit for Review"
|
49 |
+
4. Get instant feedback on your code
|
50 |
+
|
51 |
+
## API Documentation
|
52 |
+
|
53 |
+
Access the API documentation at:
|
54 |
+
`https://huggingface.co/spaces/[YOUR-USERNAME]/code-review-assistant/docs`
|
55 |
+
|
56 |
## Deployment Instructions
|
57 |
|
58 |
1. Go to [Hugging Face Spaces](https://huggingface.co/spaces)
|
|
|
67 |
- Rename `Dockerfile.huggingface` to `Dockerfile`
|
68 |
5. Set the environment variables in Space Settings
|
69 |
6. Deploy!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
src/config.py
CHANGED
@@ -26,7 +26,7 @@ class Config:
|
|
26 |
MAX_OUTPUT_LENGTH = int(os.getenv("MAX_OUTPUT_LENGTH", 1024))
|
27 |
TEMPERATURE = float(os.getenv("TEMPERATURE", 0.7))
|
28 |
TOP_P = float(os.getenv("TOP_P", 0.95))
|
29 |
-
HUGGING_FACE_TOKEN = os.getenv("HUGGING_FACE_TOKEN", "
|
30 |
|
31 |
# Database Settings
|
32 |
DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./code_review.db")
|
|
|
26 |
MAX_OUTPUT_LENGTH = int(os.getenv("MAX_OUTPUT_LENGTH", 1024))
|
27 |
TEMPERATURE = float(os.getenv("TEMPERATURE", 0.7))
|
28 |
TOP_P = float(os.getenv("TOP_P", 0.95))
|
29 |
+
HUGGING_FACE_TOKEN = os.getenv("HUGGING_FACE_TOKEN", "")
|
30 |
|
31 |
# Database Settings
|
32 |
DATABASE_URL = os.getenv("DATABASE_URL", "sqlite:///./code_review.db")
|