freyam commited on
Commit
1869ec4
1 Parent(s): de10a36

Add 1000 db

Browse files
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=2):
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=2):
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=4):
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,john.smith@example.com,Finance,60000
3
- 102,Emily,Johnson,emily.johnson@example.com,Marketing,55000
4
- 103,Michael,Williams,michael.williams@example.com,HR,50000
5
- 104,Susan,Anderson,susan.anderson@example.com,IT,65000
6
- 105,David,Martin,david.martin@example.com,Sales,58000
7
- 106,Linda,Davis,linda.davis@example.com,Finance,62000
8
- 107,William,Miller,william.miller@example.com,Marketing,56000
9
- 108,Sarah,Anderson,sarah.anderson@example.com,HR,51000
10
- 109,Robert,Clark,robert.clark@example.com,IT,67000
11
- 110,Karen,Wilson,karen.wilson@example.com,Sales,59000
12
- 111,James,Brown,james.brown@example.com,Finance,61000
13
- 112,Anna,Johnson,anna.johnson@example.com,Marketing,57000
14
- 113,Christopher,Moore,christopher.moore@example.com,HR,52000
15
- 114,Laura,White,laura.white@example.com,IT,68000
16
- 115,Mark,Davis,mark.davis@example.com,Sales,60000
17
- 116,Patricia,Jones,patricia.jones@example.com,Finance,63000
18
- 117,Matthew,Taylor,matthew.taylor@example.com,Marketing,58000
19
- 118,Jennifer,Young,jennifer.young@example.com,HR,53000
20
- 119,Steven,Anderson,steven.anderson@example.com,IT,69000
21
- 120,Elizabeth,Thomas,elizabeth.thomas@example.com,Sales,61000
22
- 121,Kevin,Harris,kevin.harris@example.com,Finance,64000
23
- 122,Deborah,Smith,deborah.smith@example.com,Marketing,59000
24
- 123,Joseph,Walker,joseph.walker@example.com,HR,54000
25
- 124,Cynthia,Jackson,cynthia.jackson@example.com,IT,70000
26
- 125,Daniel,Hall,daniel.hall@example.com,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