Add 1000 db
Browse files- app.py +11 -9
- data/amazon_1000.csv +0 -0
- data/imdb_100.csv +0 -0
- data/imdb_1000.csv +0 -0
- data/twitter_1000.csv +0 -0
- data/z_employee.csv +0 -26
- data/z_sentences.csv +0 -11
app.py
CHANGED
@@ -9,6 +9,12 @@ from scripts.gender_distribution import *
|
|
9 |
|
10 |
methodologies = json.load(open("config/methodologies.json", "r"))
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
MAX_THRESHOLD = 5000
|
13 |
DATASET_CACHE = {}
|
14 |
|
@@ -16,7 +22,7 @@ DATASET_CACHE = {}
|
|
16 |
def evaluate(dataset, sampling_method, sampling_size, column, methodology):
|
17 |
try:
|
18 |
print(
|
19 |
-
f"[{dataset.name.split('/')[-1]}::{column}] - {sampling_method} {sampling_size} entries"
|
20 |
)
|
21 |
data = DATASET_CACHE.setdefault(dataset.name, pd.read_csv(dataset.name))[
|
22 |
[column]
|
@@ -125,16 +131,12 @@ with BiasAware:
|
|
125 |
)
|
126 |
|
127 |
with gr.Row():
|
128 |
-
with gr.Column(scale=
|
129 |
gr.Markdown("## Dataset")
|
130 |
|
131 |
dataset_file = gr.File(label="Dataset", file_types=["csv"])
|
132 |
dataset_examples = gr.Examples(
|
133 |
-
|
134 |
-
os.path.join(os.path.dirname(__file__), "data/imdb_100.csv"),
|
135 |
-
os.path.join(os.path.dirname(__file__), "data/z_employee.csv"),
|
136 |
-
os.path.join(os.path.dirname(__file__), "data/z_sentences.csv"),
|
137 |
-
],
|
138 |
inputs=dataset_file,
|
139 |
label="Example Datasets",
|
140 |
)
|
@@ -147,7 +149,7 @@ with BiasAware:
|
|
147 |
row_count=(5, "fixed"), col_count=(1, "fixed"), visible=False
|
148 |
)
|
149 |
|
150 |
-
with gr.Column(scale=
|
151 |
gr.Markdown("## Methodology")
|
152 |
|
153 |
methodology = gr.Radio(
|
@@ -160,7 +162,7 @@ with BiasAware:
|
|
160 |
|
161 |
methodology_metadata = gr.Markdown(visible=False)
|
162 |
|
163 |
-
with gr.Column(scale=
|
164 |
result = gr.Markdown("## Result")
|
165 |
|
166 |
result_plot = gr.Plot(show_label=False, container=False, visible=False)
|
|
|
9 |
|
10 |
methodologies = json.load(open("config/methodologies.json", "r"))
|
11 |
|
12 |
+
datasets = [
|
13 |
+
os.path.join(os.path.dirname(__file__), "data", f)
|
14 |
+
for f in os.listdir(os.path.join(os.path.dirname(__file__), "data"))
|
15 |
+
if f.endswith(".csv")
|
16 |
+
]
|
17 |
+
|
18 |
MAX_THRESHOLD = 5000
|
19 |
DATASET_CACHE = {}
|
20 |
|
|
|
22 |
def evaluate(dataset, sampling_method, sampling_size, column, methodology):
|
23 |
try:
|
24 |
print(
|
25 |
+
f"[{dataset.name.split('/')[-1]}::{column}] - {sampling_method} {sampling_size} entries using {methodology}"
|
26 |
)
|
27 |
data = DATASET_CACHE.setdefault(dataset.name, pd.read_csv(dataset.name))[
|
28 |
[column]
|
|
|
131 |
)
|
132 |
|
133 |
with gr.Row():
|
134 |
+
with gr.Column(scale=1):
|
135 |
gr.Markdown("## Dataset")
|
136 |
|
137 |
dataset_file = gr.File(label="Dataset", file_types=["csv"])
|
138 |
dataset_examples = gr.Examples(
|
139 |
+
examples=datasets,
|
|
|
|
|
|
|
|
|
140 |
inputs=dataset_file,
|
141 |
label="Example Datasets",
|
142 |
)
|
|
|
149 |
row_count=(5, "fixed"), col_count=(1, "fixed"), visible=False
|
150 |
)
|
151 |
|
152 |
+
with gr.Column(scale=1):
|
153 |
gr.Markdown("## Methodology")
|
154 |
|
155 |
methodology = gr.Radio(
|
|
|
162 |
|
163 |
methodology_metadata = gr.Markdown(visible=False)
|
164 |
|
165 |
+
with gr.Column(scale=2):
|
166 |
result = gr.Markdown("## Result")
|
167 |
|
168 |
result_plot = gr.Plot(show_label=False, container=False, visible=False)
|
data/amazon_1000.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/imdb_100.csv
DELETED
The diff for this file is too large to render.
See raw diff
|
|
data/imdb_1000.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/twitter_1000.csv
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/z_employee.csv
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
EmployeeID,FirstName,LastName,Email,Department,Salary
|
2 |
-
101,John,Smith,[email protected],Finance,60000
|
3 |
-
102,Emily,Johnson,[email protected],Marketing,55000
|
4 |
-
103,Michael,Williams,[email protected],HR,50000
|
5 |
-
104,Susan,Anderson,[email protected],IT,65000
|
6 |
-
105,David,Martin,[email protected],Sales,58000
|
7 |
-
106,Linda,Davis,[email protected],Finance,62000
|
8 |
-
107,William,Miller,[email protected],Marketing,56000
|
9 |
-
108,Sarah,Anderson,[email protected],HR,51000
|
10 |
-
109,Robert,Clark,[email protected],IT,67000
|
11 |
-
110,Karen,Wilson,[email protected],Sales,59000
|
12 |
-
111,James,Brown,[email protected],Finance,61000
|
13 |
-
112,Anna,Johnson,[email protected],Marketing,57000
|
14 |
-
113,Christopher,Moore,[email protected],HR,52000
|
15 |
-
114,Laura,White,[email protected],IT,68000
|
16 |
-
115,Mark,Davis,[email protected],Sales,60000
|
17 |
-
116,Patricia,Jones,[email protected],Finance,63000
|
18 |
-
117,Matthew,Taylor,[email protected],Marketing,58000
|
19 |
-
118,Jennifer,Young,[email protected],HR,53000
|
20 |
-
119,Steven,Anderson,[email protected],IT,69000
|
21 |
-
120,Elizabeth,Thomas,[email protected],Sales,61000
|
22 |
-
121,Kevin,Harris,[email protected],Finance,64000
|
23 |
-
122,Deborah,Smith,[email protected],Marketing,59000
|
24 |
-
123,Joseph,Walker,[email protected],HR,54000
|
25 |
-
124,Cynthia,Jackson,[email protected],IT,70000
|
26 |
-
125,Daniel,Hall,[email protected],Sales,62000
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data/z_sentences.csv
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
ID,Sentences,Gender Bias Test
|
2 |
-
1,The doctor examined the patient.,Neutral
|
3 |
-
2,The teacher helped the student with their homework.,Neutral
|
4 |
-
3,The engineer designed the new software.,Neutral
|
5 |
-
4,The nurse cared for the sick child.,Neutral
|
6 |
-
5,The chef prepared a delicious meal.,Neutral
|
7 |
-
6,The firefighter bravely rescued people from the burning building.,Neutral
|
8 |
-
7,The police officer maintained law and order in the city.,Neutral
|
9 |
-
8,The scientist conducted groundbreaking research.,Neutral
|
10 |
-
9,The artist created a beautiful masterpiece.,Neutral
|
11 |
-
10,The CEO made important decisions for the company.,Neutral
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|