Upload 6 files
Browse files- README.md +62 -13
- app.py +185 -0
- developer_productivity_model.joblib +3 -0
- feature_names.json +1 -0
- requirements.txt +5 -0
- scaler.joblib +3 -0
README.md
CHANGED
|
@@ -1,13 +1,62 @@
|
|
| 1 |
-
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
app_file: app.py
|
| 9 |
-
pinned: false
|
| 10 |
-
license: mit
|
| 11 |
-
---
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: GitHub Developer Productivity Predictor
|
| 3 |
+
emoji: ๐
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: mit
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# ๐ GitHub Developer Productivity Predictor
|
| 14 |
+
|
| 15 |
+
This is an AI-powered tool that predicts developer productivity scores based on GitHub activity metrics.
|
| 16 |
+
|
| 17 |
+
## ๐ฏ What it does
|
| 18 |
+
|
| 19 |
+
The model analyzes 6 key developer metrics to predict a productivity score (0-100):
|
| 20 |
+
|
| 21 |
+
- **Daily Coding Hours**: Average hours spent coding per day
|
| 22 |
+
- **Commits Per Day**: Average number of commits made per day
|
| 23 |
+
- **Pull Requests Per Week**: Average number of pull requests created per week
|
| 24 |
+
- **Issues Closed Per Week**: Average number of issues resolved per week
|
| 25 |
+
- **Active Repositories**: Number of repositories actively contributed to
|
| 26 |
+
- **Code Reviews Per Week**: Average number of code reviews performed per week
|
| 27 |
+
|
| 28 |
+
## ๐ค Model Details
|
| 29 |
+
|
| 30 |
+
- **Algorithm**: Random Forest Regressor
|
| 31 |
+
- **Features**: 6 numeric GitHub activity metrics
|
| 32 |
+
- **Performance**: Trained on synthetic GitHub developer data
|
| 33 |
+
- **Preprocessing**: StandardScaler for feature normalization
|
| 34 |
+
|
| 35 |
+
## ๐ฎ How to Use
|
| 36 |
+
|
| 37 |
+
1. Enter your GitHub activity metrics in the input fields
|
| 38 |
+
2. Click "Predict Productivity Score" to get your score
|
| 39 |
+
3. Try the example buttons to see different developer profiles
|
| 40 |
+
|
| 41 |
+
## ๐ Score Interpretation
|
| 42 |
+
|
| 43 |
+
- **80-100**: ๐ Excellent - High productivity developer!
|
| 44 |
+
- **70-79**: โ
Very Good - Above average productivity!
|
| 45 |
+
- **60-69**: ๐ Good - Solid productivity level!
|
| 46 |
+
- **50-59**: โ๏ธ Average - Room for improvement!
|
| 47 |
+
- **Below 50**: ๐ Below Average - Consider focusing on key metrics!
|
| 48 |
+
|
| 49 |
+
## โ ๏ธ Disclaimer
|
| 50 |
+
|
| 51 |
+
This is a demonstration model for educational purposes. Real developer productivity depends on many factors beyond GitHub metrics, including code quality, collaboration, problem-solving skills, and project complexity.
|
| 52 |
+
|
| 53 |
+
## ๐ ๏ธ Technical Stack
|
| 54 |
+
|
| 55 |
+
- **Frontend**: Gradio
|
| 56 |
+
- **Backend**: Python, scikit-learn
|
| 57 |
+
- **Model**: Random Forest Regressor
|
| 58 |
+
- **Deployment**: Hugging Face Spaces
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
*Built with โค๏ธ for the developer community*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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import joblib
|
| 3 |
+
import numpy as np
|
| 4 |
+
import pandas as pd
|
| 5 |
+
from sklearn.preprocessing import StandardScaler
|
| 6 |
+
|
| 7 |
+
# Load the trained model and scaler
|
| 8 |
+
model = joblib.load('developer_productivity_model.joblib')
|
| 9 |
+
scaler = joblib.load('scaler.joblib')
|
| 10 |
+
|
| 11 |
+
def predict_productivity(daily_coding_hours, commits_per_day, pull_requests_per_week,
|
| 12 |
+
issues_closed_per_week, active_repos, code_reviews_per_week):
|
| 13 |
+
"""
|
| 14 |
+
Predict developer productivity score based on numeric features.
|
| 15 |
+
|
| 16 |
+
Parameters:
|
| 17 |
+
- daily_coding_hours: float (hours spent coding per day)
|
| 18 |
+
- commits_per_day: int (number of commits per day)
|
| 19 |
+
- pull_requests_per_week: int (number of pull requests per week)
|
| 20 |
+
- issues_closed_per_week: int (number of issues closed per week)
|
| 21 |
+
- active_repos: int (number of active repositories)
|
| 22 |
+
- code_reviews_per_week: int (number of code reviews per week)
|
| 23 |
+
|
| 24 |
+
Returns:
|
| 25 |
+
- predicted_score: float (predicted productivity score)
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
try:
|
| 29 |
+
# Create feature array
|
| 30 |
+
features = np.array([[
|
| 31 |
+
daily_coding_hours,
|
| 32 |
+
commits_per_day,
|
| 33 |
+
pull_requests_per_week,
|
| 34 |
+
issues_closed_per_week,
|
| 35 |
+
active_repos,
|
| 36 |
+
code_reviews_per_week
|
| 37 |
+
]])
|
| 38 |
+
|
| 39 |
+
# Scale features
|
| 40 |
+
features_scaled = scaler.transform(features)
|
| 41 |
+
|
| 42 |
+
# Make prediction
|
| 43 |
+
prediction = model.predict(features_scaled)[0]
|
| 44 |
+
|
| 45 |
+
score = round(prediction, 2)
|
| 46 |
+
|
| 47 |
+
# Add interpretation
|
| 48 |
+
if score >= 80:
|
| 49 |
+
interpretation = "๐ Excellent - High productivity developer!"
|
| 50 |
+
elif score >= 70:
|
| 51 |
+
interpretation = "โ
Very Good - Above average productivity!"
|
| 52 |
+
elif score >= 60:
|
| 53 |
+
interpretation = "๐ Good - Solid productivity level!"
|
| 54 |
+
elif score >= 50:
|
| 55 |
+
interpretation = "โ๏ธ Average - Room for improvement!"
|
| 56 |
+
else:
|
| 57 |
+
interpretation = "๐ Below Average - Consider focusing on key metrics!"
|
| 58 |
+
|
| 59 |
+
return f"{score} - {interpretation}"
|
| 60 |
+
|
| 61 |
+
except Exception as e:
|
| 62 |
+
return f"Error in prediction: {str(e)}"
|
| 63 |
+
|
| 64 |
+
# Create Gradio interface
|
| 65 |
+
with gr.Blocks(title="GitHub Developer Productivity Predictor", theme=gr.themes.Soft()) as demo:
|
| 66 |
+
gr.Markdown(
|
| 67 |
+
"""
|
| 68 |
+
# ๐ GitHub Developer Productivity Predictor
|
| 69 |
+
|
| 70 |
+
This AI model predicts developer productivity scores based on GitHub activity metrics.
|
| 71 |
+
Enter your development metrics below to get your predicted productivity score!
|
| 72 |
+
|
| 73 |
+
**Features used for prediction:**
|
| 74 |
+
- Daily coding hours
|
| 75 |
+
- Commits per day
|
| 76 |
+
- Pull requests per week
|
| 77 |
+
- Issues closed per week
|
| 78 |
+
- Active repositories
|
| 79 |
+
- Code reviews per week
|
| 80 |
+
"""
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
with gr.Row():
|
| 84 |
+
with gr.Column():
|
| 85 |
+
daily_hours = gr.Number(
|
| 86 |
+
label="Daily Coding Hours",
|
| 87 |
+
value=4.0,
|
| 88 |
+
minimum=0,
|
| 89 |
+
maximum=24,
|
| 90 |
+
info="Average hours spent coding per day"
|
| 91 |
+
)
|
| 92 |
+
commits_day = gr.Number(
|
| 93 |
+
label="Commits Per Day",
|
| 94 |
+
value=5,
|
| 95 |
+
minimum=0,
|
| 96 |
+
maximum=50,
|
| 97 |
+
info="Average number of commits made per day"
|
| 98 |
+
)
|
| 99 |
+
prs_week = gr.Number(
|
| 100 |
+
label="Pull Requests Per Week",
|
| 101 |
+
value=4,
|
| 102 |
+
minimum=0,
|
| 103 |
+
maximum=20,
|
| 104 |
+
info="Average number of pull requests created per week"
|
| 105 |
+
)
|
| 106 |
+
|
| 107 |
+
with gr.Column():
|
| 108 |
+
issues_week = gr.Number(
|
| 109 |
+
label="Issues Closed Per Week",
|
| 110 |
+
value=3,
|
| 111 |
+
minimum=0,
|
| 112 |
+
maximum=20,
|
| 113 |
+
info="Average number of issues resolved per week"
|
| 114 |
+
)
|
| 115 |
+
repos = gr.Number(
|
| 116 |
+
label="Active Repositories",
|
| 117 |
+
value=5,
|
| 118 |
+
minimum=0,
|
| 119 |
+
maximum=50,
|
| 120 |
+
info="Number of repositories actively contributed to"
|
| 121 |
+
)
|
| 122 |
+
reviews_week = gr.Number(
|
| 123 |
+
label="Code Reviews Per Week",
|
| 124 |
+
value=3,
|
| 125 |
+
minimum=0,
|
| 126 |
+
maximum=20,
|
| 127 |
+
info="Average number of code reviews performed per week"
|
| 128 |
+
)
|
| 129 |
+
|
| 130 |
+
with gr.Row():
|
| 131 |
+
predict_btn = gr.Button("๐ฎ Predict Productivity Score", variant="primary", size="lg")
|
| 132 |
+
clear_btn = gr.Button("๐ Clear", variant="secondary")
|
| 133 |
+
|
| 134 |
+
output = gr.Textbox(
|
| 135 |
+
label="Productivity Prediction",
|
| 136 |
+
placeholder="Click 'Predict Productivity Score' to see your result...",
|
| 137 |
+
interactive=False
|
| 138 |
+
)
|
| 139 |
+
|
| 140 |
+
# Example buttons
|
| 141 |
+
gr.Markdown("### ๐ Try these examples:")
|
| 142 |
+
with gr.Row():
|
| 143 |
+
high_prod_btn = gr.Button("๐ High Productivity Developer")
|
| 144 |
+
avg_prod_btn = gr.Button("โ๏ธ Average Developer")
|
| 145 |
+
beginner_btn = gr.Button("๐ฑ Beginner Developer")
|
| 146 |
+
|
| 147 |
+
# Event handlers
|
| 148 |
+
predict_btn.click(
|
| 149 |
+
fn=predict_productivity,
|
| 150 |
+
inputs=[daily_hours, commits_day, prs_week, issues_week, repos, reviews_week],
|
| 151 |
+
outputs=output
|
| 152 |
+
)
|
| 153 |
+
|
| 154 |
+
clear_btn.click(
|
| 155 |
+
fn=lambda: [4.0, 5, 4, 3, 5, 3, ""],
|
| 156 |
+
outputs=[daily_hours, commits_day, prs_week, issues_week, repos, reviews_week, output]
|
| 157 |
+
)
|
| 158 |
+
|
| 159 |
+
high_prod_btn.click(
|
| 160 |
+
fn=lambda: [6.0, 10, 8, 6, 8, 5],
|
| 161 |
+
outputs=[daily_hours, commits_day, prs_week, issues_week, repos, reviews_week]
|
| 162 |
+
)
|
| 163 |
+
|
| 164 |
+
avg_prod_btn.click(
|
| 165 |
+
fn=lambda: [4.0, 5, 4, 3, 5, 3],
|
| 166 |
+
outputs=[daily_hours, commits_day, prs_week, issues_week, repos, reviews_week]
|
| 167 |
+
)
|
| 168 |
+
|
| 169 |
+
beginner_btn.click(
|
| 170 |
+
fn=lambda: [3.0, 2, 2, 1, 2, 1],
|
| 171 |
+
outputs=[daily_hours, commits_day, prs_week, issues_week, repos, reviews_week]
|
| 172 |
+
)
|
| 173 |
+
|
| 174 |
+
gr.Markdown(
|
| 175 |
+
"""
|
| 176 |
+
### ๐ About the Model
|
| 177 |
+
This Random Forest model was trained on GitHub developer activity data and uses 6 key metrics to predict productivity scores (0-100).
|
| 178 |
+
The model achieves good performance in predicting developer productivity based on quantifiable GitHub activities.
|
| 179 |
+
|
| 180 |
+
**Note**: This is a demonstration model. Actual productivity depends on many factors beyond GitHub metrics.
|
| 181 |
+
"""
|
| 182 |
+
)
|
| 183 |
+
|
| 184 |
+
if __name__ == "__main__":
|
| 185 |
+
demo.launch()
|
developer_productivity_model.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e3c3691e8f0fb4bdea31a0d458d6702ef3bd6fe0bae6e377a507dffaf3beeccd
|
| 3 |
+
size 388001
|
feature_names.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
["daily_coding_hours", "commits_per_day", "pull_requests_per_week", "issues_closed_per_week", "active_repos", "code_reviews_per_week"]
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==4.44.0
|
| 2 |
+
joblib==1.3.2
|
| 3 |
+
numpy==1.24.3
|
| 4 |
+
pandas==2.0.3
|
| 5 |
+
scikit-learn==1.3.0
|
scaler.joblib
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:58c3cafb0ca38a5181eff58e595505296f56e491749a38c2daaa2a7313e34746
|
| 3 |
+
size 1143
|