Spaces:
Runtime error
Runtime error
Commit ·
6dcb7f9
1
Parent(s): 9c227d0
modification
Browse files- app.py +2 -0
- utils/plot.py +1 -0
app.py
CHANGED
|
@@ -42,9 +42,11 @@ class GenderPredictorApp:
|
|
| 42 |
return prediction
|
| 43 |
def predict_github_url(self, url):
|
| 44 |
commit_info = CommitInfo(url)
|
|
|
|
| 45 |
df,first_commit_dates = commit_info.get_first_commit_dates()
|
| 46 |
first_commit_dates[['Predicted_Gender', 'Confidence']] = first_commit_dates['Author'].apply(lambda name: pd.Series(self.gender_predictor.predict_gender(name)))
|
| 47 |
first_commit_dates['Predicted_Gender'] = first_commit_dates['Predicted_Gender'].replace({0: "Male", 1: "Female", 2: "Unknown"})
|
|
|
|
| 48 |
Gender_Percentage=plot.get_gender_percentage(first_commit_dates)
|
| 49 |
|
| 50 |
|
|
|
|
| 42 |
return prediction
|
| 43 |
def predict_github_url(self, url):
|
| 44 |
commit_info = CommitInfo(url)
|
| 45 |
+
print(url)
|
| 46 |
df,first_commit_dates = commit_info.get_first_commit_dates()
|
| 47 |
first_commit_dates[['Predicted_Gender', 'Confidence']] = first_commit_dates['Author'].apply(lambda name: pd.Series(self.gender_predictor.predict_gender(name)))
|
| 48 |
first_commit_dates['Predicted_Gender'] = first_commit_dates['Predicted_Gender'].replace({0: "Male", 1: "Female", 2: "Unknown"})
|
| 49 |
+
print(first_commit_dates)
|
| 50 |
Gender_Percentage=plot.get_gender_percentage(first_commit_dates)
|
| 51 |
|
| 52 |
|
utils/plot.py
CHANGED
|
@@ -34,6 +34,7 @@ def get_commits_per_gender(gender_counts):
|
|
| 34 |
|
| 35 |
return fig
|
| 36 |
def get_gender_percentage(df):
|
|
|
|
| 37 |
counts = df['Predicted_Gender'].value_counts()
|
| 38 |
colors = ["blue", "pink", "gray"]
|
| 39 |
Gender_Percentage_plot = go.Figure(data=[go.Pie(labels=df['Predicted_Gender'].unique(), values=counts, marker=dict(colors=colors))])
|
|
|
|
| 34 |
|
| 35 |
return fig
|
| 36 |
def get_gender_percentage(df):
|
| 37 |
+
|
| 38 |
counts = df['Predicted_Gender'].value_counts()
|
| 39 |
colors = ["blue", "pink", "gray"]
|
| 40 |
Gender_Percentage_plot = go.Figure(data=[go.Pie(labels=df['Predicted_Gender'].unique(), values=counts, marker=dict(colors=colors))])
|