satyamr196 commited on
Commit
e7185a2
·
1 Parent(s): 43efa17

added React app files for testing, build commands added to the readme.md metadata

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
.gitignore CHANGED
@@ -1,23 +1,26 @@
1
- # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
-
3
- # dependencies
4
- /node_modules
5
- /.pnp
6
- .pnp.js
7
-
8
- # testing
9
- /coverage
10
-
11
- # production
12
- /build
13
-
14
- # misc
15
- .DS_Store
16
- .env.local
17
- .env.development.local
18
- .env.test.local
19
- .env.production.local
20
-
21
  npm-debug.log*
22
  yarn-debug.log*
23
  yarn-error.log*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logs
2
+ logs
3
+ *.log
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  npm-debug.log*
5
  yarn-debug.log*
6
  yarn-error.log*
7
+ pnpm-debug.log*
8
+ lerna-debug.log*
9
+
10
+ node_modules
11
+ dist
12
+ dist-ssr
13
+ *.local
14
+ *.env
15
+ .gitignore
16
+
17
+ # Editor directories and files
18
+ .vscode/*
19
+ !.vscode/extensions.json
20
+ .idea
21
+ .DS_Store
22
+ *.suo
23
+ *.ntvs*
24
+ *.njsproj
25
+ *.sln
26
+ *.sw?
README.md CHANGED
@@ -1,82 +1,176 @@
1
  ---
2
- title: Static React App Test
3
- emoji: 🐠
4
- colorFrom: indigo
5
- colorTo: red
6
  sdk: static
7
  pinned: false
8
- app_build_command: npm run build
9
- app_file: build/index.html
10
- short_description: Testing how static apps are created using react template
11
  ---
12
 
13
- # Getting Started with Create React App
14
 
15
- This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
 
 
 
 
 
 
16
 
17
- ## Available Scripts
18
 
19
- In the project directory, you can run:
20
 
21
- ### `npm start`
 
 
 
 
 
 
 
 
22
 
23
- Runs the app in the development mode.\
24
- Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
25
 
26
- The page will reload when you make changes.\
27
- You may also see any lint errors in the console.
28
 
29
- ### `npm test`
30
 
31
- Launches the test runner in the interactive watch mode.\
32
- See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
33
 
34
- ### `npm run build`
35
 
36
- Builds the app for production to the `build` folder.\
37
- It correctly bundles React in production mode and optimizes the build for the best performance.
 
 
38
 
39
- The build is minified and the filenames include the hashes.\
40
- Your app is ready to be deployed!
41
 
42
- See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
 
44
- ### `npm run eject`
45
 
46
- **Note: this is a one-way operation. Once you `eject`, you can't go back!**
 
 
 
 
 
47
 
48
- If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
49
 
50
- Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
51
 
52
- You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
 
 
53
 
54
- ## Learn More
55
 
56
- You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
 
 
57
 
58
- To learn React, check out the [React documentation](https://reactjs.org/).
59
 
60
- ### Code Splitting
 
 
61
 
62
- This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
63
 
64
- ### Analyzing the Bundle Size
 
 
 
65
 
66
- This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
 
67
 
68
- ### Making a Progressive Web App
 
 
 
 
69
 
70
- This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
71
 
72
- ### Advanced Configuration
73
 
74
- This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
75
 
76
- ### Deployment
77
 
78
- This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
79
 
80
- ### `npm run build` fails to minify
81
 
82
- This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Static React Vite App ASR FairBench
3
+ emoji: 🐨
4
+ colorFrom: blue
5
+ colorTo: green
6
  sdk: static
7
  pinned: false
8
+ short_description: Static vite app with React
9
+ app_build_command: "npm run build"
10
+ app_file: "dist/index.html"
11
  ---
12
 
13
+ # ASR LEADERBOARD [[Link]](https://satyamr196-asr-fairbench.static.hf.space)
14
 
15
+ ## Screenshots
16
+ ![](/public/Req_home.png)
17
+ ![](/public/Req_result.png)
18
+ ![](/public/Req_result2.png)
19
+ ![](/public/Req_result3.png)
20
+ ![](/public/LBoard.png)
21
+ ![](/public/Dataset.png)
22
 
 
23
 
24
+ ### Features
25
 
26
+ - **Intuitive UI** – A simple, clean, and visually appealing interface
27
+ - **Fast Model Auditing** – Submit a model and get audited within minutes.
28
+ - **Graphical Insight**s – Results are visualized using box plots and histograms, which can be exported as PDF. [📄Download Result PDF](public/Print_Results.pdf)
29
+ - **Leaderboard Publishing** – Publish audited results to a dynamic leaderboard.
30
+ - **Advanced Leaderboard Features** – Filter by model name, sort by any column, and export data as CSV or PDF.
31
+ - **Optimized Frontend Performance** – Configured the React.js frontend to improve initial load time by 30–50%.
32
+ - **Efficient Backend Processing** – Built with Flask and runs on Google Colab, utilizing GPUs for fast LLM inference.
33
+ - **Fully Reproducible** – The application can be replicated from the GitHub codebase by following the provided instructions.
34
+ - **Deployment** – Application is deployed on Hugging Face Spaces for broader accessibility. [[Link]](https://huggingface.co/spaces/satyamr196/ASR-FairBench)
35
 
36
+ ### Tech Stack
 
37
 
38
+ **Client:** React, Vite, PrimeReact UI, Styled Components, Axios, Recharts, React Router, React-Plotly, React-katex
 
39
 
40
+ **Server(Using Docker):** Flask, Python, Hugging Face Transformers, Hugging Face Hub, Hugging Face Dataset, NumPy, Pandas, gunicorn, torch, statsmodels
41
 
42
+ **Server(Using Google Colab):** Flask, Colab, Ngrok ,Python, PyMongo, Hugging Face Transformers, NumPy, Pandas, torch, statsmodels
 
43
 
44
+ ## API Reference
45
 
46
+ #### Welcome message
47
+ ```http
48
+ GET /
49
+ ```
50
 
51
+ #### Run Audit for Huggin Face ASR model
 
52
 
53
+ ```http
54
+ GET /api?ASR_model=<HF_model_name>
55
+ ```
56
+ Example :
57
+ ```
58
+ {baseUrl}/api?ASR_model=openai/whisper-medium
59
+ ```
60
+ #### Get leaderboard data
61
+ ```http
62
+ GET /fetch
63
+ ```
64
+ #### Insert generated leaderboard data to database
65
+ ```http
66
+ POST /insert
67
+ ```
68
 
 
69
 
70
+ ## Run Locally
71
+ #### <u>Prerequisites</u> :
72
+ - **Node.js**: Make sure you have Node.js v22.12.0 or higher installed on your machine. You can download it from [Node.js official website](https://nodejs.org/).
73
+ - **Docker**: You are required to install Docker Desktop [(Link 1)](https://www.docker.com/products/docker-desktop/) [(Link 2)](https://docs.docker.com/get-started/get-docker/) to build and run docker container on your system.(Method 1)
74
+ - **Google Colab**: You will need a Google account to access Google Colab.(Method 2)
75
+ - **Ngrok**: Sign up for a free account on [ngrok](https://ngrok.com/) to expose your local server to the internet.(Method 2)
76
 
77
+ ### <u>Frontend</u> :
78
 
79
+ Clone the project from GitHub to your local machine.
80
 
81
+ ```bash
82
+ git clone https://github.com/SatyamR196/ASR-FairBench.git
83
+ ```
84
 
85
+ Go to the project directory
86
 
87
+ ```bash
88
+ cd ASR-FairBench
89
+ ```
90
 
91
+ Install dependencies
92
 
93
+ ```bash
94
+ npm install
95
+ ```
96
 
97
+ Start the react app
98
 
99
+ ```bash
100
+ npm run dev
101
+ ```
102
+ On running above instructions sucessfully, following message with website link should should appear in the terminal:
103
 
104
+ <img src="/public/CF1.png" alt="Project Logo" width="400">
105
+ Now you can open the link in the web browser, home page will look something like this :
106
 
107
+ <!-- <img src="/public/CF_home.png" alt="Project Logo" width="100%"> -->
108
+ ![](/public/CF_home.png)
109
+ <!-- <img src="/public/CF_Leaderboard.png" alt="Project Logo" width="100%"> -->
110
+ ![](/public/CF_Leaderboard.png)
111
+ ##### Congratulations 🤗 ! on sucessfully cloning the frontend, next we will be setting up the backend on google colab
112
 
113
+ ### <u>Backend</u> :
114
 
115
+ #### <i><u>Method 1</u></i> : Using Docker + Hugging Face
116
 
117
+ - Create account on hugging face and also generate acess token with read and write permission.
118
 
119
+ ![](/public/Access_token.png)
120
 
121
+ - Then you can selet either clone the repository or duplicate the space option to create your own space.
122
 
123
+ ![](/public/clone_repo.png)
124
 
125
+ - Then your server will be running on hugging face space. You can access the server clicking on 3 dots icon and then select "embed this space" option.
126
+
127
+ - You can also run the server locally using docker. For that you need to install docker on your system. Then select the "Run locally" option as shown in above image.
128
+
129
+ - Finally paste the server link in the frontend code > App.jsx > baseUrl. Now frontend will be able to access the backend server.
130
+
131
+ ![](/public/Url_app.png)
132
+
133
+
134
+ #### <i><u>Method 2</u></i> : Using Google Colab
135
+ - Open the Google Colab notebook using the link below.
136
+
137
+ Link to Backend Server Collab notebook : <a href="https://colab.research.google.com/drive/1nIA8IyejvuRauvFbOCbpRlN1sEIK01Gh#scrollTo=_bZc5hkTEfWE"> Click here </a>
138
+
139
+ - Open your google drive, Create a folder named "ASR_Fairness_Dataset" and upload the above colab notebook there.
140
+
141
+ - You also need to upload the dataset to your google drive. Download the dataset from the link below, name it "asr_fairness_audio" and upload it to the same folder "ASR_Fairness_Dataset" in your google drive. [Dataset Link](https://drive.google.com/drive/folders/1lTT8NF9hVRpO4NYrn2qV8dNTmP9CNtVG)
142
+
143
+ - Additionally, you can also download the CSV files which contains the results of the ASR models on the dataset. You need to place the folders in the folder "ASR_Fairness_Dataset" in your google drive.
144
+ [OpenAi Model Result Link](https://drive.google.com/drive/folders/1mWnlz4wIfIYkxOLB8zjfta62Eg9ZaB4P?usp=drive_link)
145
+ [Facebook Model Result Link](https://drive.google.com/drive/folders/1-VDnwbLPDrUWdw67x-KUYYQ46PFT5lbd?usp=drive_link)
146
+
147
+ - finally, you need to download the test.csv file which contains the details about audio dataset like gender,ethnicity,etc. You need to place the folders in the folder "ASR_Fairness_Dataset" in your google drive.
148
+ [test.csv Link](https://drive.google.com/file/d/1-54UJWB7g9pXB8t5X6wYdBA_KClRIgLf/view?usp=drive_link)
149
+
150
+ - Now, your drive folder structure should look like this :
151
+ ![](/public/Backend4.png)
152
+
153
+ - Before running the Backend server on colab notebook, make sure to sign up on ngrok and get your auth token and replace it in colab notebook. [Ngok Website](https://dashboard.ngrok.com/get-started/your-authtoken)
154
+ ![](/public/ngrok_token.png)
155
+
156
+ ```bash
157
+ !ngrok config add-authtoken <YOUR NGROK TOKEN>
158
+ ```
159
+
160
+ - Now, run the colab notebook. It will ask for permission to access your google drive, allow it.
161
+
162
+ - After running the notebook, ngok will give you a public url to access the backend server api. Copy the link and paste it in the frontend code, App.jsx , baseUrl.
163
+ ![](/public/Url_app.png)
164
+
165
+ **Note :** If you change the name of any the folder, make sure to change the path in the colab notebook as well.
166
+
167
+ ##### Sucessful 🤗 ! now you can run the application on your local machine
168
+
169
+ ### Feedback & Support
170
+
171
+ If you have any feedback or need support, feel free to reach out to us:
172
+
173
+ - **Anand Rai**: [raianand.1991@gmail.com](mailto:raianand.1991@gmail.com)
174
+ - **Prof. Animesh Mukherjee**: [animeshm@gmail.com](mailto:animeshm@gmail.com)
175
+ - **Satyam Rahangdale**: [satyamrahangdale196@gmail.com](mailto:satyamrahangdale196@gmail.com)
176
+ - **Utkarsh Anand**: [ua28012006@gmail.com](mailto:ua28012006@gmail.com)
eslint.config.js ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import js from '@eslint/js'
2
+ import globals from 'globals'
3
+ import reactHooks from 'eslint-plugin-react-hooks'
4
+ import reactRefresh from 'eslint-plugin-react-refresh'
5
+
6
+ export default [
7
+ { ignores: ['dist'] },
8
+ {
9
+ files: ['**/*.{js,jsx}'],
10
+ languageOptions: {
11
+ ecmaVersion: 2020,
12
+ globals: globals.browser,
13
+ parserOptions: {
14
+ ecmaVersion: 'latest',
15
+ ecmaFeatures: { jsx: true },
16
+ sourceType: 'module',
17
+ },
18
+ },
19
+ plugins: {
20
+ 'react-hooks': reactHooks,
21
+ 'react-refresh': reactRefresh,
22
+ },
23
+ rules: {
24
+ ...js.configs.recommended.rules,
25
+ ...reactHooks.configs.recommended.rules,
26
+ 'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
27
+ 'react-refresh/only-export-components': [
28
+ 'warn',
29
+ { allowConstantExport: true },
30
+ ],
31
+ },
32
+ },
33
+ ]
index.html ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/png" href="/Logo_small.png" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>ASR-FairBench</title>
8
+ </head>
9
+ <body>
10
+ <div id="root"></div>
11
+ <script type="module" src="/src/main.jsx"></script>
12
+ </body>
13
+ </html>
package-lock.json ADDED
The diff for this file is too large to render. See raw diff
 
package.json CHANGED
@@ -1,39 +1,47 @@
1
  {
2
- "name": "react-template",
3
- "version": "0.1.0",
4
  "private": true,
5
- "dependencies": {
6
- "@testing-library/dom": "^10.4.0",
7
- "@testing-library/jest-dom": "^6.6.3",
8
- "@testing-library/react": "^16.3.0",
9
- "@testing-library/user-event": "^13.5.0",
10
- "react": "^19.1.0",
11
- "react-dom": "^19.1.0",
12
- "react-scripts": "5.0.1",
13
- "web-vitals": "^2.1.4"
14
- },
15
  "scripts": {
16
- "start": "react-scripts start",
17
- "build": "react-scripts build",
18
- "test": "react-scripts test",
19
- "eject": "react-scripts eject"
20
  },
21
- "eslintConfig": {
22
- "extends": [
23
- "react-app",
24
- "react-app/jest"
25
- ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  },
27
- "browserslist": {
28
- "production": [
29
- ">0.2%",
30
- "not dead",
31
- "not op_mini all"
32
- ],
33
- "development": [
34
- "last 1 chrome version",
35
- "last 1 firefox version",
36
- "last 1 safari version"
37
- ]
38
  }
39
  }
 
1
  {
2
+ "name": "frontend",
 
3
  "private": true,
4
+ "proxy": "http://localhost:3000",
5
+ "version": "0.0.0",
6
+ "type": "module",
 
 
 
 
 
 
 
7
  "scripts": {
8
+ "dev": "vite",
9
+ "build": "vite build",
10
+ "lint": "eslint .",
11
+ "preview": "vite preview"
12
  },
13
+ "dependencies": {
14
+ "axios": "^1.8.4",
15
+ "chart.js": "^4.4.8",
16
+ "jspdf": "^3.0.1",
17
+ "jspdf-autotable": "^5.0.2",
18
+ "katex": "^0.16.22",
19
+ "lucide-react": "^0.485.0",
20
+ "mongodb": "^6.15.0",
21
+ "plotly.js": "^3.0.1",
22
+ "primeflex": "^4.0.0",
23
+ "primeicons": "^7.0.0",
24
+ "primereact": "^10.9.3",
25
+ "react": "^19.0.0",
26
+ "react-d3-speedometer": "^3.1.1",
27
+ "react-dom": "^19.0.0",
28
+ "react-hook-form": "^7.54.2",
29
+ "react-katex": "^3.1.0",
30
+ "react-plotly.js": "^2.6.0",
31
+ "react-router-dom": "^7.4.0",
32
+ "react-to-print": "^3.1.0",
33
+ "recharts": "^2.15.1",
34
+ "styled-components": "^6.1.16"
35
  },
36
+ "devDependencies": {
37
+ "@eslint/js": "^9.21.0",
38
+ "@types/react": "^19.0.10",
39
+ "@types/react-dom": "^19.0.4",
40
+ "@vitejs/plugin-react": "^4.3.4",
41
+ "eslint": "^9.21.0",
42
+ "eslint-plugin-react-hooks": "^5.1.0",
43
+ "eslint-plugin-react-refresh": "^0.4.19",
44
+ "globals": "^15.15.0",
45
+ "vite": "^6.2.4"
 
46
  }
47
  }
public/Access_token.png ADDED

Git LFS Details

  • SHA256: adfd8b240df3f20a27a6b2787eac5dca06df7d5ca21f1d9611420ee0c9827ab2
  • Pointer size: 131 Bytes
  • Size of remote file: 313 kB
public/Backend1.png ADDED

Git LFS Details

  • SHA256: 30e033787c5b1c7ab202da5d0aaeee217c877d9d51b12bac5dd62e85141f44e1
  • Pointer size: 131 Bytes
  • Size of remote file: 236 kB
public/Backend2.png ADDED

Git LFS Details

  • SHA256: cb9b2d686204871b1c3577c606967469a7bb636ab4cca7db80f95fa692ae2748
  • Pointer size: 131 Bytes
  • Size of remote file: 295 kB
public/Backend3.png ADDED

Git LFS Details

  • SHA256: 34253153ac22b6ec87959adf38cf889e255e57de682c5d1c20ee0eeb09024cf1
  • Pointer size: 132 Bytes
  • Size of remote file: 1.49 MB
public/Backend4.png ADDED

Git LFS Details

  • SHA256: 1e2fc3bfeef9ce80da3f5de1f1709db0ac88f4d48a8a8ecef6d4d8a0a72adffc
  • Pointer size: 132 Bytes
  • Size of remote file: 1.48 MB
public/CF1.png ADDED

Git LFS Details

  • SHA256: f7c10db3c5e37df05b5cbdad637b8ff1d869fb2de42c5516d6c0f8179d6bfa43
  • Pointer size: 130 Bytes
  • Size of remote file: 21.5 kB
public/CF_Leaderboard.png ADDED

Git LFS Details

  • SHA256: c6b07eed95e329f59ade0f718a44190e5a391fe589583f1981eb71c3b2a07494
  • Pointer size: 131 Bytes
  • Size of remote file: 165 kB
public/CF_home.png ADDED

Git LFS Details

  • SHA256: 5f0a3537f1f62dfc83e2a3f677fdd77503ae77966ceeab9e8ce778b42d2fde76
  • Pointer size: 131 Bytes
  • Size of remote file: 314 kB
public/Dataset.png ADDED

Git LFS Details

  • SHA256: 566275ce906f111b2fb9f314a48c216882d2d2aa45b547884e7c22c1933979e7
  • Pointer size: 131 Bytes
  • Size of remote file: 267 kB
public/Github_logo.png ADDED

Git LFS Details

  • SHA256: a150635d58d37da6070bfddf347c9661031db5da0e75c8e3124035f027ade382
  • Pointer size: 131 Bytes
  • Size of remote file: 349 kB
public/LBoard.png ADDED

Git LFS Details

  • SHA256: 2df0625f36f7271858d6670870bddce119f6d13340d4bec4435e79c166a1353b
  • Pointer size: 131 Bytes
  • Size of remote file: 204 kB
public/Logo_small.png ADDED

Git LFS Details

  • SHA256: 08d239970cc36eb1c3f4fa8fc1b67e9612546463424ce4e0920b887946c4e5fb
  • Pointer size: 131 Bytes
  • Size of remote file: 106 kB
public/Print_Results.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8cabdd57709db052244a452f583e05f71fcd5e610622d618f8cf479633cce05
3
+ size 1267188
public/Req_home.png ADDED

Git LFS Details

  • SHA256: 799b4f1d246ed12fb6a513b535ebef1048559b4e35c21209ece48c9d7ad3936b
  • Pointer size: 131 Bytes
  • Size of remote file: 259 kB
public/Req_result.png ADDED

Git LFS Details

  • SHA256: 978d3aeb396d93ed6b3b26ce198185c0f517523e2cfc44547b6098e9e856d0a0
  • Pointer size: 131 Bytes
  • Size of remote file: 126 kB
public/Req_result2.png ADDED

Git LFS Details

  • SHA256: ba02dc367469b71dfaf3a99f49ee5979ea6bb2a5d58d8941dcf7ff569f90931b
  • Pointer size: 131 Bytes
  • Size of remote file: 143 kB
public/Req_result3.png ADDED

Git LFS Details

  • SHA256: 5592a844ad9d20ebca1c3c33f3b66bec3d785775b348a5387d1c0969571b0e26
  • Pointer size: 131 Bytes
  • Size of remote file: 181 kB
public/Url_app.png ADDED

Git LFS Details

  • SHA256: cf821f6367664b860f848096b8ee5bb0fdc96e355e7d8dc1f4832a388af7304d
  • Pointer size: 131 Bytes
  • Size of remote file: 453 kB
public/clone_repo.png ADDED

Git LFS Details

  • SHA256: 60f0642da3fff6f5a530558b8a5da57399ec8b524ae770fbff4ea1d28faa49f1
  • Pointer size: 131 Bytes
  • Size of remote file: 229 kB
public/ngrok_token.png ADDED

Git LFS Details

  • SHA256: 0860771c8d9e90d5a63322405de51abca6f478881f5a78a3cce6b2cf40a1d4bc
  • Pointer size: 131 Bytes
  • Size of remote file: 135 kB
public/vite.svg ADDED
src/App.css CHANGED
@@ -1,34 +1,18 @@
1
- .App {
2
- text-align: center;
3
- }
4
-
5
- .App-logo {
6
- height: 40vmin;
7
- pointer-events: none;
8
- }
9
-
10
- @media (prefers-reduced-motion: no-preference) {
11
- .App-logo {
12
- animation: App-logo-spin infinite 20s linear;
13
- }
14
- }
15
 
16
- .App-header {
17
- background-color: #282c34;
18
- min-height: 100vh;
19
- display: flex;
20
- flex-direction: column;
21
- align-items: center;
22
- justify-content: center;
23
- font-size: calc(10px + 2vmin);
24
- color: white;
25
  }
26
-
27
- .App-link {
28
- color: #61dafb;
29
  }
30
 
31
- @keyframes App-logo-spin {
32
  from {
33
  transform: rotate(0deg);
34
  }
@@ -36,3 +20,4 @@
36
  transform: rotate(360deg);
37
  }
38
  }
 
 
1
+ @import 'primeicons/primeicons.css';
2
+ @import 'primeflex/primeflex.css';
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
+ #root {
5
+ /* max-width: 1280px; */
6
+ margin: 0 auto;
7
+ padding: 0rem;
8
+ text-align: center;
 
 
 
 
9
  }
10
+ html,body{
11
+ margin: 0;
12
+ padding: 0;
13
  }
14
 
15
+ @keyframes logo-spin {
16
  from {
17
  transform: rotate(0deg);
18
  }
 
20
  transform: rotate(360deg);
21
  }
22
  }
23
+
src/App.jsx ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useState } from "react";
2
+ import { media } from "./Utils/helper.js";
3
+ // import "primereact/resources/themes/lara-light-cyan/theme.css";
4
+ import './App.css'
5
+ import "primereact/resources/themes/lara-light-cyan/theme.css";
6
+ // import "primereact/resources/themes/bootstrap4-light-blue/theme.css"
7
+ import axios from "axios";
8
+ import {
9
+ Routes,
10
+ Route,
11
+ Navigate,
12
+ useLocation
13
+ } from "react-router-dom";
14
+ import { Home } from "./components/Home";
15
+ import { Request } from "./components/Request";
16
+ import { Leaderboard } from "./components/Leaderboard";
17
+ import Nav from "./styled_components/Nav";
18
+ import styled from "styled-components";
19
+ import { Toast } from "primereact/toast";
20
+ import { React, useRef, useEffect } from "react";
21
+ import { useContext } from "react";
22
+ import { DataContext } from "./DataContext";
23
+ import Logo from "./assets/logo.png"
24
+ import Metrics from "./components/Metrics";
25
+ import Dataset from "./components/Dataset";
26
+ import Contact from "./components/Contact";
27
+ import ProgressToast from "./styled_components/ProgressToast";
28
+ import SpinnerIcon from "./styled_components/SpinnerIcon";
29
+ import { Password } from 'primereact/password';
30
+
31
+ function App() {
32
+ const toast = useRef(null);
33
+ const [baseUrl, setBaseUrl] = useState("https://satyamr196-asr-fairbench-sever-v2.hf.space")
34
+ // const [baseUrl,setBaseUrl] = useState("http://localhost:7860")
35
+ console.log(baseUrl);
36
+ const location = useLocation();
37
+
38
+ const showSucess = () => {//For toast
39
+ toast.current.show({ severity: 'success', summary: 'Success', detail: 'Model added to Leaderboard 🤗' });
40
+ };
41
+ const showError = () => {//For toast
42
+ toast.current.show({ severity: 'error', summary: 'Error', detail: 'Error adding model to Leaderboard 🥹' });
43
+ };
44
+ const showInfo = () => {//For toast
45
+ toast.current.show({ severity: 'info', summary: 'Info', detail: 'Model already added to the Leaderboard 🫢' });
46
+ };
47
+ return (
48
+ <>
49
+ <Wrapper>
50
+ <Toast ref={toast} />
51
+ <HeadImg>
52
+ <img src={Logo}></img>
53
+ </HeadImg>
54
+ <Text>
55
+ 🎙️ <b>ASR-FAIRBENCH</b> is an open benchmarking platform dedicated to evaluating the <b>fairness and accuracy</b> of Automatic Speech Recognition (ASR) models.
56
+ Our mission is to assess ASR models' performance across diverse demographic groups using the <b><a href="https://ai.meta.com/datasets/speech-fairness-dataset/" target="_blank">Fair Speech Dataset</a></b>.
57
+
58
+ Models are ranked based on the <b>Fairness Adjusted Accuracy Score (FAAS)</b>, which integrates both <b>Word Error Rate (WER)</b> and a <b>Fairness Score</b>, ensuring that models deliver equitable performance across different accents, genders, and age groups.
59
+
60
+ Explore the 📈 <b>Metrics</b> tab for details on our evaluation process and visit the 📂 <b>Dataset</b> tab for a summary of the Fair Speech Dataset.
61
+
62
+ Think your ASR model is both inclusive and high-performing? Put it to the test and claim your spot on the leaderboard! ✨
63
+ <b>📄<a href="http://arxiv.org/abs/2505.11572" target="_blank">(Paper Link)</a> </b>&nbsp;
64
+ <b><i className="pi pi-github"></i> <a href="https://github.com/SatyamR196/ASR-FairBench" target="_blank">(Github Link)</a></b>
65
+ </Text>
66
+ <div className="container">
67
+ <Nav />
68
+ <Routes>
69
+ <Route path="/home" element={<Home baseUrl={baseUrl} />} />
70
+ <Route path="/request" element={<Request showSucess={showSucess} showError={showError} showInfo={showInfo} baseUrl={baseUrl} />} />
71
+ <Route path="/leaderboard" element={<Leaderboard baseUrl={baseUrl} />} />
72
+ <Route path="/metrics" element={<Metrics />} />
73
+ <Route path="/dataset" element={<Dataset />} />
74
+ <Route path="/contact" element={<Contact />} />
75
+ <Route path="/*" element={<Navigate to="/leaderboard" />} />
76
+ </Routes>
77
+ </div>
78
+ </Wrapper>
79
+
80
+ <div style={{ display: location.pathname === "/request" ? "block" : "none" }}>
81
+ <ProgressToast baseUrl={baseUrl} />
82
+ </div>
83
+ </>
84
+ );
85
+ }
86
+
87
+ const HeadImg = styled.div`
88
+ display: flex;
89
+ justify-content: center; // Centers the image horizontally
90
+ align-items: center; // Aligns image vertically
91
+ width: 100%;
92
+ margin: 1rem 0 0 0;
93
+
94
+ img {
95
+ max-width: 300px; // Adjust size as needed
96
+ height: auto; // Maintain aspect ratio
97
+ }
98
+ `
99
+ const Text = styled.p`
100
+ /* color: gray; */
101
+ color: #4b5563;
102
+ padding-inline: 5rem;
103
+ margin-top:0;
104
+ margin-bottom:0;
105
+ font-size:1.05rem !important ;
106
+ @media ${media.tablet} {
107
+ font-size: 14px;
108
+ padding-inline: 2rem;
109
+ }
110
+ @media ${media.mobile} {
111
+ font-size: 12px;
112
+ padding-inline: 0.8rem;
113
+ }
114
+ `
115
+
116
+ const Wrapper = styled.div`
117
+ /* position: 'relative'; */
118
+ /* background: linear-gradient(to right, #6dd5fa, #2980b9); */
119
+ background-color: #ffffff;
120
+ /* background-color: #fa2020; */
121
+ color: black;
122
+ min-height: 100vh;
123
+ display: flex;
124
+ flex-direction: column;
125
+ justify-content: left;
126
+ align-items: left;
127
+ text-align: left;
128
+ font-family: Arial, sans-serif;
129
+
130
+ .container {
131
+ width: 90%;
132
+ margin: auto;
133
+ /* margin-top: 3rem; */
134
+ padding: 2rem;
135
+ background: transparent;
136
+ /* background: rgb(255, 255, 255); */
137
+ backdrop-filter: blur(12px);
138
+ /* box-shadow: 0 8px 32px rgba(0, 0, 0, 0.37); */
139
+ border-radius: 20px;
140
+ transition: transform 0.3s ease-in-out;
141
+ @media ${media.tablet} {
142
+ width: 95%;
143
+ padding: 1.2rem;
144
+ }
145
+ @media ${media.mobile} {
146
+ width: 98%;
147
+ padding: 0.8rem;
148
+ }
149
+ }
150
+ h1 {
151
+ font-size: 3rem;
152
+ color: #000000;
153
+ /* color: #3b82f6; */
154
+ text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.5);
155
+ margin-bottom: 2rem;
156
+ }
157
+ h3{
158
+ color: #000000;
159
+ }
160
+ p {
161
+ /* font-size: 1.2rem; */
162
+ /* color: #000000; */
163
+ /* margin-bottom: 2rem; */
164
+ }
165
+ .graph-container {
166
+ display: none;
167
+ margin-top: 2rem;
168
+ text-align: center;
169
+ }
170
+ canvas {
171
+ margin: 20px auto;
172
+ max-width: 600px;
173
+ }
174
+ hr {
175
+ margin: 1.5px 0;
176
+ border: none;
177
+ border-top: 1.5px solid rgba(25, 75, 255, 0.7);
178
+ }
179
+ input {
180
+ padding: 10px;
181
+ /* margin-bottom: 20px; */
182
+ border: none;
183
+ border-radius: 10px;
184
+ /* width: 65%; */
185
+ text-align: center;
186
+ }
187
+ `;
188
+
189
+ export default App;
src/DataContext.jsx ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { createContext, useState } from "react";
2
+
3
+ export const DataContext = createContext();
4
+
5
+ export const DataProvider = ({ children }) => {
6
+ const [sharedData, setSharedData] = useState(null);
7
+
8
+ return (
9
+ <DataContext.Provider value={{ sharedData, setSharedData }}>
10
+ {children}
11
+ </DataContext.Provider>
12
+ );
13
+ };
src/Utils/helper.js ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // styles/media.js
2
+ export const sizes = {
3
+ mobile: '480px',
4
+ tablet: '768px',
5
+ laptop: '1200px',
6
+ };
7
+
8
+ export const media = {
9
+ mobile: `(max-width: ${sizes.mobile})`,
10
+ tablet: `(max-width: ${sizes.tablet})`,
11
+ laptop: `(max-width: ${sizes.laptop})`,
12
+ };
src/assets/ASR_HeadImg.svg ADDED
src/assets/Age_group.png ADDED

Git LFS Details

  • SHA256: 58dbf40272df457a94cad6d8d77280be04e8fbc1ef5eb7d7ea90c316075f6dc2
  • Pointer size: 130 Bytes
  • Size of remote file: 67.8 kB
src/assets/Cluster.png ADDED

Git LFS Details

  • SHA256: 09a5ec8523b9d912a0ccaa17ae035afd7500a4f37db77a47e4429808e678ae34
  • Pointer size: 131 Bytes
  • Size of remote file: 691 kB
src/assets/Dataset_table.png ADDED

Git LFS Details

  • SHA256: 6d1d95162a9550d66169f764d72b0cd243368fbdec431cd74df08877f21bcd9e
  • Pointer size: 130 Bytes
  • Size of remote file: 56.2 kB
src/assets/Dataset_tableHQ.png ADDED

Git LFS Details

  • SHA256: bb525edd77bedf5359a04bd3c5551902fdad40e786e35e6c7d83d53c3061a686
  • Pointer size: 130 Bytes
  • Size of remote file: 81.5 kB
src/assets/Ethnicity.png ADDED

Git LFS Details

  • SHA256: 65a5d7893dde54e5cd3787bba0362a2a49a087b0ed777d6095604cdfb67e3c9d
  • Pointer size: 130 Bytes
  • Size of remote file: 90.2 kB
src/assets/FAW.png ADDED

Git LFS Details

  • SHA256: 1beaac73f528a1cfbd65e13d300cbb21fbbebe442f474d3d982ed478c8baf8a0
  • Pointer size: 132 Bytes
  • Size of remote file: 1.14 MB
src/assets/Logo_new.png ADDED

Git LFS Details

  • SHA256: 462d128a6ca35b34297d62e9a90462a9243f5bf2f019a5977111911ff46360b0
  • Pointer size: 131 Bytes
  • Size of remote file: 676 kB
src/assets/Logo_noBG.png ADDED

Git LFS Details

  • SHA256: 89dba7843ecd181b6f488f9ca74ca9c70f5768733a8cc36857da0ed734de23d9
  • Pointer size: 131 Bytes
  • Size of remote file: 754 kB
src/assets/SEG_group.png ADDED

Git LFS Details

  • SHA256: 576f870682162f4822eed70e4cab76cde8ae544743ea45b67503c1a4c49e28c4
  • Pointer size: 130 Bytes
  • Size of remote file: 64 kB
src/assets/illustration-your-users.svg ADDED
src/assets/logo.png ADDED

Git LFS Details

  • SHA256: 7a3dc3334f74d496d298d4f7db742c8bf225a195af67a0cfa2f34b8950868e47
  • Pointer size: 131 Bytes
  • Size of remote file: 615 kB
src/assets/main_LOGO.png ADDED

Git LFS Details

  • SHA256: e9630a4a3910bff75097628e73de30eee737f04ad757da546a272573ac4b53ff
  • Pointer size: 131 Bytes
  • Size of remote file: 378 kB
src/assets/main_LOGO2.png ADDED

Git LFS Details

  • SHA256: ec970693492c461ecaff7a322288e98fe67dea867590fa9f97ff8cc2af4b3686
  • Pointer size: 131 Bytes
  • Size of remote file: 303 kB
src/assets/react.svg ADDED
src/components/Contact.jsx ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react'
2
+ import styled from 'styled-components'
3
+ import CImg from '../assets/illustration-your-users.svg'
4
+ import ScoreCard from '../styled_components/Scorecard'
5
+ import { media } from '../Utils/helper'
6
+
7
+ function Contact() {
8
+ return (
9
+ <Container>
10
+ <h1>Contact Us</h1>
11
+ <Mdiv>
12
+ <Ldiv>
13
+ <ScoreCard direction="column" label="Prof. Animesh Mukherjee :" score="animeshm@cse.iitkgp.ac.in"></ScoreCard>
14
+ <ScoreCard direction="column" label="Anand Rai :" score="raianand.1991@gmail.com"></ScoreCard>
15
+ <ScoreCard direction="column" label="Utkarsh Anand :" score="ua28012006@gmail.com"></ScoreCard>
16
+ <ScoreCard direction="column" fontSize={1.3} label="Satyam R :" score="satyamrahangdale196@kgpian.iitkgp.ac.in"></ScoreCard>
17
+ </Ldiv>
18
+ <Rdiv>
19
+ <Image src={CImg}></Image>
20
+ </Rdiv>
21
+ </Mdiv>
22
+ </Container>
23
+ )
24
+ }
25
+
26
+ export default Contact
27
+
28
+ const Container = styled.div`
29
+ display: flex;
30
+ flex-direction: column;
31
+ padding: 2rem 1rem;
32
+ padding-top: 0;
33
+ margin-inline: auto;
34
+ /* align-items: center; */
35
+ /* justify-content: center; */
36
+ @media ${media.tablet} {
37
+ padding: 1.2rem;
38
+ }
39
+ @media ${media.mobile} {
40
+ padding: 0.8rem;
41
+ }
42
+ `
43
+ const Mdiv = styled.div`
44
+ display: flex;
45
+ gap: 3rem;
46
+ align-items: flex-start;
47
+
48
+
49
+ @media ${media.laptop} {
50
+ gap: 2rem;
51
+ flex-direction: column;
52
+ align-items: center;
53
+ }
54
+
55
+ @media ${media.tablet} {
56
+ flex-direction: column;
57
+ gap: 2rem;
58
+ align-items: center;
59
+ }
60
+ `;
61
+
62
+ const Ldiv = styled.div`
63
+ display: flex;
64
+ flex-direction: column;
65
+ gap: 1rem;
66
+ flex: 1;
67
+ min-width: 280px;
68
+ max-width: 100%;
69
+ `;
70
+
71
+ const Rdiv = styled.div`
72
+ flex: 1;
73
+ display: flex;
74
+ justify-content: center;
75
+ align-items: center;
76
+ `;
77
+
78
+ const Image = styled.img`
79
+ width: 100%;
80
+ /* max-width: 500px; */
81
+ height: auto;
82
+
83
+ @media ${media.tablet} {
84
+ max-width: 100%;
85
+ }
86
+ `;
src/components/Dataset.jsx ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react'
2
+ import styled from 'styled-components'
3
+ import AgeGroup from '../assets/Age_group.png'
4
+ import SEGGroup from '../assets/SEG_group.png'
5
+ import EthGroup from '../assets/Ethnicity.png'
6
+ import FAWGroup from '../assets/FAW.png'
7
+ import Dateset from '../assets/Dataset_tableHQ.png'
8
+ import ClusterGroup from '../assets/Cluster.png'
9
+ import ScoreCard from '../styled_components/Scorecard'
10
+ import { Button } from 'primereact/button';
11
+ import { media } from '../Utils/helper'
12
+
13
+ function Dataset() {
14
+ return (
15
+ <Container>
16
+ <h1>Dataset Overview</h1>
17
+
18
+ <Section>
19
+ <Head>Introduction</Head>
20
+ <Para>
21
+ We use Meta's FairSpeech dataset to conduct fairness audits of speech recognition models submitted to our leaderboard. This dataset was specifically designed to address fairness gaps across diverse demographic groups. The complete FairSpeech dataset includes <b>26,471 utterances</b> recorded by <b>593 individuals</b> across the United States. Participants self-identified their personal information, including age, gender, ethnicity, geographic location, and whether they consider themselves native English speakers.
22
+ </Para>
23
+ <Para>
24
+ For our leaderboard evaluation, we use a stratified 10% sample from the FairSpeech dataset. We run inference using these test samples to evaluate the fairness of submitted models across different demographic groups. The original dataset spans seven domains: <b>music</b>, <b>capture</b>, <b>utilities</b>, <b>notification control</b>, <b>messaging</b>, <b>calling</b>, and <b>dictation</b>. In response to these domain-specific prompts, participants recorded audio commands such as searching for songs or making plans to meet friends.
25
+ </Para>
26
+ <Button label="Learn more about FairSpeech" icon="pi pi-file" link onClick={() => window.open('https://ai.meta.com/datasets/speech-fairness-dataset/', '_blank')} />
27
+ </Section>
28
+
29
+ <Gridbox>
30
+ <ScoreCard width="32rem" label="Dataset Source:" score="FairSpeech Dataset" />
31
+ <ScoreCard width="32rem" label="Dataset Released on: " score="JULY 13, 2023" />
32
+ <ScoreCard width="32rem" label="Total Audios in Original Dataset: " score={26471} />
33
+ <ScoreCard width="32rem" label="Evaluation Sample Size: " score="2647" />
34
+ <ScoreCard width="32rem" label="Average utterance length: " score="7.42 sec" />
35
+ <ScoreCard width="32rem" label="Primary Data Type: " score="Audio (.wav)" />
36
+ </Gridbox>
37
+
38
+ <Section>
39
+ <Head>Our Testing Strategy: Stratified Sampling</Head>
40
+ <Para mb={1}>
41
+ For our leaderboard evaluations, we employ stratified sampling to select a representative 10% subset from the FairSpeech dataset. Stratified sampling is critical in Automatic Speech Recognition (ASR) fairness testing to ensure that test sets reflect the overall dataset's distribution. This approach ensures demographic factors, background noise conditions, and linguistic diversity are properly represented, allowing us to evaluate model robustness and fairness across varied populations.
42
+ </Para>
43
+ <Image src={Dateset} />
44
+ </Section>
45
+
46
+ <Section>
47
+ <Head>Age Group by Gender Distribution</Head>
48
+ <Image src={AgeGroup} />
49
+ </Section>
50
+
51
+ <Section>
52
+ <Head>Socioeconomic Group by Gender Distribution</Head>
53
+ <Image src={SEGGroup} />
54
+ </Section>
55
+
56
+ <Section>
57
+ <Head>Ethnicity Distribution</Head>
58
+ <Image src={EthGroup} />
59
+ </Section>
60
+
61
+ <Section>
62
+ <Head>Frequently Used Words</Head>
63
+ <Image src={FAWGroup} />
64
+ </Section>
65
+
66
+
67
+ </Container>
68
+ )
69
+ }
70
+
71
+ export default Dataset;
72
+
73
+ const Container = styled.div`
74
+ display: flex;
75
+ flex-direction: column;
76
+ padding: 2rem 0rem;
77
+ padding-top: 0;
78
+ margin-inline: auto;
79
+ max-width: 1200px; /* To control the width */
80
+ `;
81
+
82
+ const Gridbox = styled.div`
83
+ display: grid;
84
+ margin: auto;
85
+ grid-template-columns: 1fr 1fr;
86
+ grid-gap: 2rem 4rem;
87
+ padding: 2rem 0;
88
+ @media ${media.tablet} {
89
+ grid-gap: 3rem;
90
+ }
91
+ @media ${media.mobile} {
92
+ display: flex;
93
+ flex-direction: column;
94
+ gap: 1.2rem;
95
+ }
96
+ `;
97
+
98
+ const Section = styled.section`
99
+ margin-bottom: 3rem;
100
+ `;
101
+
102
+ const Head = styled.h6`
103
+ font-size: 2rem;
104
+ color: #3b82f6;
105
+ margin-bottom: 1rem;
106
+ text-decoration: underline;
107
+ `;
108
+
109
+ const Image = styled.img`
110
+ max-width: 80%;
111
+ display: block;
112
+ margin: 1rem auto;
113
+ @media ${media.tablet} {
114
+ max-width: 90%;
115
+ }
116
+ @media ${media.mobile} {
117
+ max-width: 100%;
118
+ }
119
+ `;
120
+
121
+ const Para = styled.p`
122
+ color: #4b5563;
123
+ font-size: 1.4rem;
124
+ line-height: 1.8;
125
+ margin-bottom: ${props => props.mb || 2}rem;
126
+ text-align: justify;
127
+ `;
src/components/Home.jsx ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React from 'react'
2
+ import { useState } from 'react'
3
+ import reactLogo from '../assets/react.svg'
4
+ import viteLogo from '/vite.svg'
5
+ import axios from 'axios'
6
+ import Button from '../styled_components/Button'
7
+ import { Link } from 'react-router-dom'
8
+ import { Navigate, useNavigate } from 'react-router-dom'
9
+ import ScoreCard from '../styled_components/Scorecard'
10
+ import { Leaderboard } from './Leaderboard'
11
+ import styled from 'styled-components'
12
+ import { useContext } from 'react'
13
+ import { Head } from './Request'
14
+
15
+ function Home({baseUrl}) {
16
+ let [result, setResult] = useState(false);
17
+ const navigate = useNavigate();
18
+
19
+ const getData = async () => {
20
+ const res = await axios.get('http://localhost:3000');
21
+ console.log(res.data);
22
+ setResult(res.data);
23
+ }
24
+ const handleClick = ()=>{
25
+ console.log("hi navigatering");
26
+ navigate('/leaderboard');
27
+ }
28
+
29
+ return (
30
+ <>
31
+ <h1>ASR fairness benchmark</h1>
32
+ {/* <button onClick={getData}> GET DATA </button> */}
33
+ {/* { result && <p> {result.message} at {result.endpoint} route </p> }
34
+ <p className="read-the-docs">
35
+ This platform allows users to request automatic speech recognition machine learning models, view performance metrics, and track model leaderboards.
36
+ </p>
37
+ <br></br> */}
38
+ {/* <Button type="submit" shadow="blue" bg="#3b82f6" color="white" onClick={handleClick}>Explore</Button> */}
39
+ {/* <newHead>sdsdsWelcome to ASR-Fairbench</newHead> */}
40
+ <Leaderboard baseUrl={baseUrl} />
41
+ </>
42
+ )
43
+ }
44
+
45
+ export {Home}
46
+
47
+ const newHead = styled(Head)`
48
+ background: #3b82f6;
49
+ color: #a9a9a9;
50
+ padding: 1rem;
51
+ font-size: 2rem;
52
+ text-align: center;
53
+ `;
src/components/Leaderboard.jsx ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useState, useEffect, useRef } from 'react';
2
+ import { DataTable } from 'primereact/datatable';
3
+ import { Column } from 'primereact/column';
4
+ import Table from '../styled_components/Table';
5
+ import { Button } from 'primereact/button';
6
+ import { Tooltip } from 'primereact/tooltip';
7
+ import jsPDF from 'jspdf';
8
+ import autoTable from 'jspdf-autotable';
9
+ import axios from "axios";
10
+ import { useContext } from "react";
11
+ import { DataContext } from "../DataContext";
12
+ import { ProgressSpinner } from 'primereact/progressspinner';
13
+ import styled from 'styled-components';
14
+
15
+ export function Leaderboard({ baseUrl }) {
16
+
17
+ const [products, setProducts] = useState(null);
18
+ const dt = useRef(null);
19
+ const { sharedData, setSharedData } = useContext(DataContext);
20
+
21
+
22
+ let data = [
23
+ { Model: "OpenAi/whisper", WER: 0.15, FS: 0.87, FS_G: 8.41, FS_L: 0.85, FS_SEG: 0.8, FS_E: 0.8 },
24
+ { Model: "OpenAi/whisper-mini", WER: 0.25, FS: 0.8, FS_G: 0.85, FS_L: 0.75, FS_SEG: 0.65, FS_E: 0.8 }
25
+ ]
26
+
27
+ useEffect(() => {
28
+ if (!(sharedData && sharedData.Leaderboard)) {
29
+ const fetchData = async () => {
30
+ const headers = {
31
+ 'ngrok-skip-browser-warning': "10008"
32
+ };
33
+ const res = await axios.get(`${baseUrl}/fetch`, { headers });
34
+ let Data = res.data.data; // Await the promise
35
+ const uniqueData = Data.filter((value, index, self) =>
36
+ index === self.findIndex((t) => t.Model === value.Model)
37
+ );
38
+ setProducts(uniqueData); // Set the resolved data to state
39
+ setSharedData({ ...sharedData, Leaderboard: uniqueData })
40
+ }
41
+
42
+ fetchData();
43
+ } else {
44
+ setProducts(sharedData.Leaderboard);
45
+ }
46
+
47
+
48
+ }, [sharedData, setSharedData, baseUrl]);
49
+
50
+
51
+ const exportCSV = (selectionOnly) => {
52
+ dt.current.exportCSV({ selectionOnly });
53
+ };
54
+
55
+ const exportPdf = () => {
56
+ // const doc = new jsPDF();
57
+ const doc = new jsPDF({ orientation: 'landscape' });
58
+
59
+ // Add heading
60
+ // Set font size and get page width
61
+ doc.setFontSize(16);
62
+ const pageWidth = doc.internal.pageSize.width; // Get page width
63
+ const text = 'Leaderboard Report';
64
+ const textWidth = doc.getTextWidth(text); // Get text width
65
+ const xPosition = (pageWidth - textWidth) / 2; // Center position
66
+
67
+ // Add centered heading
68
+ doc.text(text, xPosition, 15);
69
+
70
+ // Define table headers
71
+ const columns = [
72
+ { header: 'Model Name', dataKey: 'Model' },
73
+ { header: 'Fairness Adjusted ASR Score', dataKey: 'FAAS' },
74
+ { header: 'Average WER', dataKey: 'WER' },
75
+ { header: 'Average RTFX', dataKey: 'RTFX' },
76
+ { header: 'Overall Fairness Score', dataKey: 'FS' },
77
+ { header: 'Fairness Score (Gender)', dataKey: 'FS_G' },
78
+ { header: 'Fairness Score (First Language)', dataKey: 'FS_L' },
79
+ { header: 'Fairness Score (Socioeconomic Background)', dataKey: 'FS_SEG' },
80
+ { header: 'Fairness Score (Ethnicity)', dataKey: 'FS_E' }
81
+ ];
82
+
83
+ // Convert data into row format
84
+ const rows = products.map(row => columns.map(col => row[col.dataKey]));
85
+
86
+ // Call autoTable properly
87
+ autoTable(doc, {
88
+ theme: 'grid',
89
+ head: [columns.map(col => col.header)], // Table headers
90
+ body: rows, // Table data
91
+ startY: 20, // Set Y position after the heading
92
+ styles: { lineWidth: 0.15 }, // Ensure grid lines are visible
93
+ headStyles: { textColor: 255, lineWidth: 0.15 } // Ensure header has grid lines
94
+ });
95
+
96
+ doc.save('Leaderboard.pdf');
97
+ };
98
+
99
+
100
+ const header = (
101
+ <div className="flex align-items-center justify-content-end gap-2">
102
+ <Tooltip target=".tooltip-btn" />
103
+ <Button type="button" icon="pi pi-file" rounded onClick={() => exportCSV(false)} className="tooltip-btn" data-pr-tooltip="Export CSV" />
104
+ {/* <Button type="button" icon="pi pi-file-excel" severity="success" rounded onClick={exportExcel} data-pr-tooltip="XLS" /> */}
105
+ <Button type="button" icon="pi pi-file-pdf" severity="warning" rounded onClick={exportPdf} className="tooltip-btn" data-pr-tooltip="Export PDF" />
106
+ </div>
107
+ );
108
+ //! For making the model name hyperlinks
109
+ const [selectedCell, setSelectedCell] = useState(null);
110
+ const onCellClick = (event) => {
111
+ if(event.field!="Model") return ;
112
+ const url = `https://huggingface.co/${event.value}`; // Replace with your URL
113
+ window.open(url, "_blank", "noopener,noreferrer");
114
+ };
115
+
116
+ return (<>
117
+ {/* <h1>Leaderboard</h1> */}
118
+ {/* <h3>Track Top performing models</h3> */}
119
+ <H3>Leaderboard of the ASR models audited on this platform :</H3>
120
+ {products ? (<div className="card border-round-3xl overflow-hidden shadow-2">
121
+ <Tooltip target=".export-buttons>button" position="bottom" />
122
+ <DataTable ref={dt} header={header} value={products} removableSort showGridlines
123
+ sortField="FAAS"
124
+ sortOrder={-1}
125
+ tableStyle={{ minWidth: '20rem' }}
126
+ cellSelection selectionMode="single" selection={selectedCell}
127
+ onSelectionChange={(e) => setSelectedCell(e.value)} metaKeySelection={false}
128
+ onCellClick={onCellClick}
129
+ >
130
+ <Column field="Model" header="Model Name" sortable filter></Column>
131
+ <Column field="FAAS" header="Fairness Adjusted ASR Score" sortable></Column>
132
+ <Column field="WER" header="Average WER" sortable></Column>
133
+ <Column field="RTFX" header="Average RTFX" sortable></Column>
134
+ <Column field="FS" header="Overall Fairness Score" sortable></Column>
135
+ <Column field="FS_G" header="Fairness Score (Gender)" sortable></Column>
136
+ <Column field="FS_L" header="Fairness Score (First Language)" sortable></Column>
137
+ <Column field="FS_SEG" header="Fairness Score (Socioeconomic Background)" sortable></Column>
138
+ <Column field="FS_E" header="Fairness Score (Ethnicity)" sortable></Column>
139
+ </DataTable>
140
+ </div>)
141
+ :
142
+ (<ProgressSpinner style={{ width: '200px', height: '200px' }} strokeWidth="3" />)}
143
+
144
+
145
+ <br></br>
146
+ </>)
147
+ }
148
+
149
+ const H3 = styled.h3`
150
+ color: #515458 !important
151
+ `
152
+