SanderGi commited on
Commit
38024bc
·
1 Parent(s): 25d4f3a

clean up and make contribution ready

Browse files
.gitignore ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Python build
2
+ .eggs/
3
+ gradio.egg-info
4
+ dist/
5
+ dist-lite/
6
+ *.pyc
7
+ __pycache__/
8
+ *.py[cod]
9
+ *$py.class
10
+ build/
11
+ !js/build/
12
+ !js/build/dist/
13
+ __tmp/*
14
+ *.pyi
15
+ !gradio/stubs/**/*.pyi
16
+ .ipynb_checkpoints/
17
+ .python-version
18
+ =23.2
19
+
20
+ # JS build
21
+ gradio/templates/*
22
+ gradio/node/*
23
+ gradio/_frontend_code/*
24
+ js/gradio-preview/test/*
25
+
26
+ # Secrets
27
+ .env
28
+
29
+ # Gradio run artifacts
30
+ *.db
31
+ *.sqlite3
32
+ gradio/launches.json
33
+ gradio/hash_seed.txt
34
+ .gradio/
35
+
36
+ # Tests
37
+ .coverage
38
+ coverage.xml
39
+ test.txt
40
+ **/snapshots/**/*.png
41
+ playwright-report/
42
+ .hypothesis
43
+ .lite-perf.json
44
+
45
+ # Etc
46
+ .idea/*
47
+ .DS_Store
48
+ *.bak
49
+ workspace.code-workspace
50
+ *.h5
51
+
52
+ # dev containers
53
+ .pnpm-store/
54
+
55
+ # log files
56
+ .pnpm-debug.log
57
+
58
+ # Local virtualenv for devs
59
+ venv
60
+
61
+ # FRP
62
+ gradio/frpc_*
63
+ .vercel
64
+
65
+ # js
66
+ node_modules
67
+ public/build/
68
+ test-results
69
+ client/js/dist/*
70
+ client/js/test.js
71
+ .config/test.py
72
+ .svelte-kit
73
+
74
+
75
+ # storybook
76
+ storybook-static
77
+ build-storybook.log
78
+ js/storybook/theme.css
79
+
80
+ # playwright
81
+ .config/playwright/.cache
.gradio/certificate.pem DELETED
@@ -1,31 +0,0 @@
1
- -----BEGIN CERTIFICATE-----
2
- MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
3
- TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
4
- cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
5
- WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
6
- ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
7
- MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
8
- h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
9
- 0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
10
- A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
11
- T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
12
- B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
13
- B5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf1b0SHzUv
14
- KBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWn
15
- OlFuhjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTn
16
- jh8BCNAw1FtxNrQHusEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbw
17
- qHyGO0aoSCqI3Haadr8faqU9GY/rOPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CI
18
- rU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
19
- HRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY9umbbjANBgkq
20
- hkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
21
- ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ
22
- 3BebYhtF8GaV0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KK
23
- NFtY2PwByVS5uCbMiogziUwthDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5
24
- ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJwTdwJx4nLCgdNbOhdjsnvzqvHu7Ur
25
- TkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nxe5AW0wdeRlN8NwdC
26
- jNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZAJzVc
27
- oyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq
28
- 4RgqsahDYVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPA
29
- mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
30
- emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
31
- -----END CERTIFICATE-----
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
CONTRIBUTING.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Contributing to Koel Labs - IPA Transcription EN
2
+ 👍🎉 First off, thanks for taking the time to contribute! 🎉👍
3
+
4
+ These are the specific contributing guidelines for the English IPA transcription leaderboard. Checkout our [general contributing guidelines here](https://github.com/KoelLabs/.github/blob/main/CONTRIBUTING.md).
5
+
6
+ ## Where to Start
7
+
8
+ 1. Read the [README.md](README.md) file to understand the purpose of this repository.
9
+ 2. Read the [DEVELOPMENT.md](DEVELOPMENT.md) file to understand how to set up your local development environment. Important design decisions will also be documented here.
10
+ 3. Read the [Code of Conduct](https://github.com/KoelLabs/.github/blob/main/CONTRIBUTING.md#code-of-conduct) to understand expectations while contributing to this project and take a look at the [FAQ](https://github.com/KoelLabs/.github/blob/main/CONTRIBUTING.md#faq) if you have any questions.
11
+ 4. Read through the [issues](https://huggingface.co/spaces/KoelLabs/IPA-Transcription-EN/discussions) to understand the current development priorities.
12
+ 5. All contributions start with an issue to discuss the change. See [how to file a bug report](https://github.com/KoelLabs/.github/blob/main/CONTRIBUTING.md#reporting-bugs), [suggest a new feature](https://github.com/KoelLabs/.github/blob/main/CONTRIBUTING.md#suggesting-enhancements), or [make your first code contribution](https://github.com/KoelLabs/.github/blob/main/CONTRIBUTING.md#your-first-code-contribution).
13
+ - Look for the [issues](https://huggingface.co/spaces/KoelLabs/IPA-Transcription-EN/discussions) tagged `good first issue` and `help wanted` for things to work on.
14
+ - Make sure to check the [existing issues](https://huggingface.co/spaces/KoelLabs/IPA-Transcription-EN/discussions) before creating a new one.
15
+ 6. Maintainers with write access to the repository will assign willing contributors to issues they request. Once assigned, fork the repository and create a branch for your work.
16
+ 7. When you are ready, submit a pull request!
17
+
18
+ ## Point of Contact
19
+
20
+ If you have any questions, feel free to reach out to [email protected] and [email protected] or open an issue. Security vulnerabilities should be reported to [email protected].
21
+
22
+ ## Legal Boilerplate
23
+
24
+ By making contributions to the Koel Labs project, you agree to retain all rights, title and interest in and to your contributions and confirm that Koel Labs can use, modify, copy, and redistribute said contributions, under its choice of terms.
DEVELOPMENT.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Development
2
+
3
+ ## Design Decisions
4
+
5
+ We specifically opt for a single-space leaderboard for simplicity. We solve the issue of keeping the gradio UI interactive while models are evaluating by using background tasks instead of a separate space.
6
+
7
+ ## Setup
8
+
9
+ ### Prerequisites
10
+
11
+ * Python 3.10
12
+ * Git
13
+ * A love for speech recognition! 🎤
14
+
15
+ ### Quick Installation
16
+
17
+ 1. Clone this repository:
18
+ ```bash
19
+ GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/spaces/KoelLabs/IPA-Transcription-EN
20
+ cd IPA-Transcription-EN
21
+ ```
22
+
23
+ 2. Set up your environment and download data:
24
+ ```bash
25
+ . ./scripts/install.sh
26
+ ```
27
+
28
+ 3. Launch the leaderboard in development mode (auto-reloads on code changes):
29
+ ```bash
30
+ . ./scripts/run-dev.sh
31
+ ```
32
+
33
+ 4. Visit `http://localhost:7860` in your browser and see the magic! ✨
34
+
35
+ ## Adding/Removing Dependencies
36
+ 0. Activate the virtual environment with `. ./venv/bin/activate`
37
+ 1. Add the dependency to `requirements.txt` (or remove it)
38
+ 2. Make sure you have no unused dependencies with `pipx run deptry .`
39
+ 3. Run `pip install -r requirements.txt`
40
+ 4. Freeze the dependencies with `pip freeze > requirements_lock.txt`
41
+
42
+ ## Run without reloading
43
+ ```bash
44
+ . ./scripts/run-prod.sh
45
+ ```
46
+
47
+ ## File Structure
48
+
49
+ The two most imporant files are `app/app.py` for the main gradio UI and `app/tasks.py` for the background tasks that evaluate models.
50
+
51
+ ```
52
+ IPA-Transcription-EN/
53
+ ├── README.md # General information about the leaderboard
54
+ ├── CONTRIBUTING.md # Contribution guidelines
55
+ ├── DEVELOPMENT.md # Development setup and design decisions
56
+ ├── requirements.txt # Python dependencies
57
+ ├── requirements_lock.txt # Locked dependencies
58
+ ├── scripts # Helper scripts
59
+ │ ├── install.sh # Install dependencies and download data
60
+ │ └── run-dev.sh # Run the leaderboard in development mode
61
+ ├── venv # Virtual environment
62
+ ├── app/ # All application code lives here
63
+ │ ├── data/ # Phoneme transcription datasets
64
+ │ ├── queue/ # Stores leaderboard state and task status
65
+ │ | ├── tasks.json # Task queue
66
+ │ | ├── results.json # Detailed evaluation results
67
+ │ | └── leaderboard.json # Compact results for leaderboard display
68
+ │ ├── app.py # Main Gradio UI
69
+ │ ├── tasks.py # Background tasks for model evaluation
70
+ │ ├── data.py # Data loading and processing
71
+ │ ├── inference.py # Model inference
72
+ │ └── phone_metrics.py # Evaluation metrics
73
+ └── img/ # Images for README and other documentation
74
+ ```
LICENSE ADDED
@@ -0,0 +1,661 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU AFFERO GENERAL PUBLIC LICENSE
2
+ Version 3, 19 November 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU Affero General Public License is a free, copyleft license for
11
+ software and other kinds of works, specifically designed to ensure
12
+ cooperation with the community in the case of network server software.
13
+
14
+ The licenses for most software and other practical works are designed
15
+ to take away your freedom to share and change the works. By contrast,
16
+ our General Public Licenses are intended to guarantee your freedom to
17
+ share and change all versions of a program--to make sure it remains free
18
+ software for all its users.
19
+
20
+ When we speak of free software, we are referring to freedom, not
21
+ price. Our General Public Licenses are designed to make sure that you
22
+ have the freedom to distribute copies of free software (and charge for
23
+ them if you wish), that you receive source code or can get it if you
24
+ want it, that you can change the software or use pieces of it in new
25
+ free programs, and that you know you can do these things.
26
+
27
+ Developers that use our General Public Licenses protect your rights
28
+ with two steps: (1) assert copyright on the software, and (2) offer
29
+ you this License which gives you legal permission to copy, distribute
30
+ and/or modify the software.
31
+
32
+ A secondary benefit of defending all users' freedom is that
33
+ improvements made in alternate versions of the program, if they
34
+ receive widespread use, become available for other developers to
35
+ incorporate. Many developers of free software are heartened and
36
+ encouraged by the resulting cooperation. However, in the case of
37
+ software used on network servers, this result may fail to come about.
38
+ The GNU General Public License permits making a modified version and
39
+ letting the public access it on a server without ever releasing its
40
+ source code to the public.
41
+
42
+ The GNU Affero General Public License is designed specifically to
43
+ ensure that, in such cases, the modified source code becomes available
44
+ to the community. It requires the operator of a network server to
45
+ provide the source code of the modified version running there to the
46
+ users of that server. Therefore, public use of a modified version, on
47
+ a publicly accessible server, gives the public access to the source
48
+ code of the modified version.
49
+
50
+ An older license, called the Affero General Public License and
51
+ published by Affero, was designed to accomplish similar goals. This is
52
+ a different license, not a version of the Affero GPL, but Affero has
53
+ released a new version of the Affero GPL which permits relicensing under
54
+ this license.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ TERMS AND CONDITIONS
60
+
61
+ 0. Definitions.
62
+
63
+ "This License" refers to version 3 of the GNU Affero General Public License.
64
+
65
+ "Copyright" also means copyright-like laws that apply to other kinds of
66
+ works, such as semiconductor masks.
67
+
68
+ "The Program" refers to any copyrightable work licensed under this
69
+ License. Each licensee is addressed as "you". "Licensees" and
70
+ "recipients" may be individuals or organizations.
71
+
72
+ To "modify" a work means to copy from or adapt all or part of the work
73
+ in a fashion requiring copyright permission, other than the making of an
74
+ exact copy. The resulting work is called a "modified version" of the
75
+ earlier work or a work "based on" the earlier work.
76
+
77
+ A "covered work" means either the unmodified Program or a work based
78
+ on the Program.
79
+
80
+ To "propagate" a work means to do anything with it that, without
81
+ permission, would make you directly or secondarily liable for
82
+ infringement under applicable copyright law, except executing it on a
83
+ computer or modifying a private copy. Propagation includes copying,
84
+ distribution (with or without modification), making available to the
85
+ public, and in some countries other activities as well.
86
+
87
+ To "convey" a work means any kind of propagation that enables other
88
+ parties to make or receive copies. Mere interaction with a user through
89
+ a computer network, with no transfer of a copy, is not conveying.
90
+
91
+ An interactive user interface displays "Appropriate Legal Notices"
92
+ to the extent that it includes a convenient and prominently visible
93
+ feature that (1) displays an appropriate copyright notice, and (2)
94
+ tells the user that there is no warranty for the work (except to the
95
+ extent that warranties are provided), that licensees may convey the
96
+ work under this License, and how to view a copy of this License. If
97
+ the interface presents a list of user commands or options, such as a
98
+ menu, a prominent item in the list meets this criterion.
99
+
100
+ 1. Source Code.
101
+
102
+ The "source code" for a work means the preferred form of the work
103
+ for making modifications to it. "Object code" means any non-source
104
+ form of a work.
105
+
106
+ A "Standard Interface" means an interface that either is an official
107
+ standard defined by a recognized standards body, or, in the case of
108
+ interfaces specified for a particular programming language, one that
109
+ is widely used among developers working in that language.
110
+
111
+ The "System Libraries" of an executable work include anything, other
112
+ than the work as a whole, that (a) is included in the normal form of
113
+ packaging a Major Component, but which is not part of that Major
114
+ Component, and (b) serves only to enable use of the work with that
115
+ Major Component, or to implement a Standard Interface for which an
116
+ implementation is available to the public in source code form. A
117
+ "Major Component", in this context, means a major essential component
118
+ (kernel, window system, and so on) of the specific operating system
119
+ (if any) on which the executable work runs, or a compiler used to
120
+ produce the work, or an object code interpreter used to run it.
121
+
122
+ The "Corresponding Source" for a work in object code form means all
123
+ the source code needed to generate, install, and (for an executable
124
+ work) run the object code and to modify the work, including scripts to
125
+ control those activities. However, it does not include the work's
126
+ System Libraries, or general-purpose tools or generally available free
127
+ programs which are used unmodified in performing those activities but
128
+ which are not part of the work. For example, Corresponding Source
129
+ includes interface definition files associated with source files for
130
+ the work, and the source code for shared libraries and dynamically
131
+ linked subprograms that the work is specifically designed to require,
132
+ such as by intimate data communication or control flow between those
133
+ subprograms and other parts of the work.
134
+
135
+ The Corresponding Source need not include anything that users
136
+ can regenerate automatically from other parts of the Corresponding
137
+ Source.
138
+
139
+ The Corresponding Source for a work in source code form is that
140
+ same work.
141
+
142
+ 2. Basic Permissions.
143
+
144
+ All rights granted under this License are granted for the term of
145
+ copyright on the Program, and are irrevocable provided the stated
146
+ conditions are met. This License explicitly affirms your unlimited
147
+ permission to run the unmodified Program. The output from running a
148
+ covered work is covered by this License only if the output, given its
149
+ content, constitutes a covered work. This License acknowledges your
150
+ rights of fair use or other equivalent, as provided by copyright law.
151
+
152
+ You may make, run and propagate covered works that you do not
153
+ convey, without conditions so long as your license otherwise remains
154
+ in force. You may convey covered works to others for the sole purpose
155
+ of having them make modifications exclusively for you, or provide you
156
+ with facilities for running those works, provided that you comply with
157
+ the terms of this License in conveying all material for which you do
158
+ not control copyright. Those thus making or running the covered works
159
+ for you must do so exclusively on your behalf, under your direction
160
+ and control, on terms that prohibit them from making any copies of
161
+ your copyrighted material outside their relationship with you.
162
+
163
+ Conveying under any other circumstances is permitted solely under
164
+ the conditions stated below. Sublicensing is not allowed; section 10
165
+ makes it unnecessary.
166
+
167
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168
+
169
+ No covered work shall be deemed part of an effective technological
170
+ measure under any applicable law fulfilling obligations under article
171
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172
+ similar laws prohibiting or restricting circumvention of such
173
+ measures.
174
+
175
+ When you convey a covered work, you waive any legal power to forbid
176
+ circumvention of technological measures to the extent such circumvention
177
+ is effected by exercising rights under this License with respect to
178
+ the covered work, and you disclaim any intention to limit operation or
179
+ modification of the work as a means of enforcing, against the work's
180
+ users, your or third parties' legal rights to forbid circumvention of
181
+ technological measures.
182
+
183
+ 4. Conveying Verbatim Copies.
184
+
185
+ You may convey verbatim copies of the Program's source code as you
186
+ receive it, in any medium, provided that you conspicuously and
187
+ appropriately publish on each copy an appropriate copyright notice;
188
+ keep intact all notices stating that this License and any
189
+ non-permissive terms added in accord with section 7 apply to the code;
190
+ keep intact all notices of the absence of any warranty; and give all
191
+ recipients a copy of this License along with the Program.
192
+
193
+ You may charge any price or no price for each copy that you convey,
194
+ and you may offer support or warranty protection for a fee.
195
+
196
+ 5. Conveying Modified Source Versions.
197
+
198
+ You may convey a work based on the Program, or the modifications to
199
+ produce it from the Program, in the form of source code under the
200
+ terms of section 4, provided that you also meet all of these conditions:
201
+
202
+ a) The work must carry prominent notices stating that you modified
203
+ it, and giving a relevant date.
204
+
205
+ b) The work must carry prominent notices stating that it is
206
+ released under this License and any conditions added under section
207
+ 7. This requirement modifies the requirement in section 4 to
208
+ "keep intact all notices".
209
+
210
+ c) You must license the entire work, as a whole, under this
211
+ License to anyone who comes into possession of a copy. This
212
+ License will therefore apply, along with any applicable section 7
213
+ additional terms, to the whole of the work, and all its parts,
214
+ regardless of how they are packaged. This License gives no
215
+ permission to license the work in any other way, but it does not
216
+ invalidate such permission if you have separately received it.
217
+
218
+ d) If the work has interactive user interfaces, each must display
219
+ Appropriate Legal Notices; however, if the Program has interactive
220
+ interfaces that do not display Appropriate Legal Notices, your
221
+ work need not make them do so.
222
+
223
+ A compilation of a covered work with other separate and independent
224
+ works, which are not by their nature extensions of the covered work,
225
+ and which are not combined with it such as to form a larger program,
226
+ in or on a volume of a storage or distribution medium, is called an
227
+ "aggregate" if the compilation and its resulting copyright are not
228
+ used to limit the access or legal rights of the compilation's users
229
+ beyond what the individual works permit. Inclusion of a covered work
230
+ in an aggregate does not cause this License to apply to the other
231
+ parts of the aggregate.
232
+
233
+ 6. Conveying Non-Source Forms.
234
+
235
+ You may convey a covered work in object code form under the terms
236
+ of sections 4 and 5, provided that you also convey the
237
+ machine-readable Corresponding Source under the terms of this License,
238
+ in one of these ways:
239
+
240
+ a) Convey the object code in, or embodied in, a physical product
241
+ (including a physical distribution medium), accompanied by the
242
+ Corresponding Source fixed on a durable physical medium
243
+ customarily used for software interchange.
244
+
245
+ b) Convey the object code in, or embodied in, a physical product
246
+ (including a physical distribution medium), accompanied by a
247
+ written offer, valid for at least three years and valid for as
248
+ long as you offer spare parts or customer support for that product
249
+ model, to give anyone who possesses the object code either (1) a
250
+ copy of the Corresponding Source for all the software in the
251
+ product that is covered by this License, on a durable physical
252
+ medium customarily used for software interchange, for a price no
253
+ more than your reasonable cost of physically performing this
254
+ conveying of source, or (2) access to copy the
255
+ Corresponding Source from a network server at no charge.
256
+
257
+ c) Convey individual copies of the object code with a copy of the
258
+ written offer to provide the Corresponding Source. This
259
+ alternative is allowed only occasionally and noncommercially, and
260
+ only if you received the object code with such an offer, in accord
261
+ with subsection 6b.
262
+
263
+ d) Convey the object code by offering access from a designated
264
+ place (gratis or for a charge), and offer equivalent access to the
265
+ Corresponding Source in the same way through the same place at no
266
+ further charge. You need not require recipients to copy the
267
+ Corresponding Source along with the object code. If the place to
268
+ copy the object code is a network server, the Corresponding Source
269
+ may be on a different server (operated by you or a third party)
270
+ that supports equivalent copying facilities, provided you maintain
271
+ clear directions next to the object code saying where to find the
272
+ Corresponding Source. Regardless of what server hosts the
273
+ Corresponding Source, you remain obligated to ensure that it is
274
+ available for as long as needed to satisfy these requirements.
275
+
276
+ e) Convey the object code using peer-to-peer transmission, provided
277
+ you inform other peers where the object code and Corresponding
278
+ Source of the work are being offered to the general public at no
279
+ charge under subsection 6d.
280
+
281
+ A separable portion of the object code, whose source code is excluded
282
+ from the Corresponding Source as a System Library, need not be
283
+ included in conveying the object code work.
284
+
285
+ A "User Product" is either (1) a "consumer product", which means any
286
+ tangible personal property which is normally used for personal, family,
287
+ or household purposes, or (2) anything designed or sold for incorporation
288
+ into a dwelling. In determining whether a product is a consumer product,
289
+ doubtful cases shall be resolved in favor of coverage. For a particular
290
+ product received by a particular user, "normally used" refers to a
291
+ typical or common use of that class of product, regardless of the status
292
+ of the particular user or of the way in which the particular user
293
+ actually uses, or expects or is expected to use, the product. A product
294
+ is a consumer product regardless of whether the product has substantial
295
+ commercial, industrial or non-consumer uses, unless such uses represent
296
+ the only significant mode of use of the product.
297
+
298
+ "Installation Information" for a User Product means any methods,
299
+ procedures, authorization keys, or other information required to install
300
+ and execute modified versions of a covered work in that User Product from
301
+ a modified version of its Corresponding Source. The information must
302
+ suffice to ensure that the continued functioning of the modified object
303
+ code is in no case prevented or interfered with solely because
304
+ modification has been made.
305
+
306
+ If you convey an object code work under this section in, or with, or
307
+ specifically for use in, a User Product, and the conveying occurs as
308
+ part of a transaction in which the right of possession and use of the
309
+ User Product is transferred to the recipient in perpetuity or for a
310
+ fixed term (regardless of how the transaction is characterized), the
311
+ Corresponding Source conveyed under this section must be accompanied
312
+ by the Installation Information. But this requirement does not apply
313
+ if neither you nor any third party retains the ability to install
314
+ modified object code on the User Product (for example, the work has
315
+ been installed in ROM).
316
+
317
+ The requirement to provide Installation Information does not include a
318
+ requirement to continue to provide support service, warranty, or updates
319
+ for a work that has been modified or installed by the recipient, or for
320
+ the User Product in which it has been modified or installed. Access to a
321
+ network may be denied when the modification itself materially and
322
+ adversely affects the operation of the network or violates the rules and
323
+ protocols for communication across the network.
324
+
325
+ Corresponding Source conveyed, and Installation Information provided,
326
+ in accord with this section must be in a format that is publicly
327
+ documented (and with an implementation available to the public in
328
+ source code form), and must require no special password or key for
329
+ unpacking, reading or copying.
330
+
331
+ 7. Additional Terms.
332
+
333
+ "Additional permissions" are terms that supplement the terms of this
334
+ License by making exceptions from one or more of its conditions.
335
+ Additional permissions that are applicable to the entire Program shall
336
+ be treated as though they were included in this License, to the extent
337
+ that they are valid under applicable law. If additional permissions
338
+ apply only to part of the Program, that part may be used separately
339
+ under those permissions, but the entire Program remains governed by
340
+ this License without regard to the additional permissions.
341
+
342
+ When you convey a copy of a covered work, you may at your option
343
+ remove any additional permissions from that copy, or from any part of
344
+ it. (Additional permissions may be written to require their own
345
+ removal in certain cases when you modify the work.) You may place
346
+ additional permissions on material, added by you to a covered work,
347
+ for which you have or can give appropriate copyright permission.
348
+
349
+ Notwithstanding any other provision of this License, for material you
350
+ add to a covered work, you may (if authorized by the copyright holders of
351
+ that material) supplement the terms of this License with terms:
352
+
353
+ a) Disclaiming warranty or limiting liability differently from the
354
+ terms of sections 15 and 16 of this License; or
355
+
356
+ b) Requiring preservation of specified reasonable legal notices or
357
+ author attributions in that material or in the Appropriate Legal
358
+ Notices displayed by works containing it; or
359
+
360
+ c) Prohibiting misrepresentation of the origin of that material, or
361
+ requiring that modified versions of such material be marked in
362
+ reasonable ways as different from the original version; or
363
+
364
+ d) Limiting the use for publicity purposes of names of licensors or
365
+ authors of the material; or
366
+
367
+ e) Declining to grant rights under trademark law for use of some
368
+ trade names, trademarks, or service marks; or
369
+
370
+ f) Requiring indemnification of licensors and authors of that
371
+ material by anyone who conveys the material (or modified versions of
372
+ it) with contractual assumptions of liability to the recipient, for
373
+ any liability that these contractual assumptions directly impose on
374
+ those licensors and authors.
375
+
376
+ All other non-permissive additional terms are considered "further
377
+ restrictions" within the meaning of section 10. If the Program as you
378
+ received it, or any part of it, contains a notice stating that it is
379
+ governed by this License along with a term that is a further
380
+ restriction, you may remove that term. If a license document contains
381
+ a further restriction but permits relicensing or conveying under this
382
+ License, you may add to a covered work material governed by the terms
383
+ of that license document, provided that the further restriction does
384
+ not survive such relicensing or conveying.
385
+
386
+ If you add terms to a covered work in accord with this section, you
387
+ must place, in the relevant source files, a statement of the
388
+ additional terms that apply to those files, or a notice indicating
389
+ where to find the applicable terms.
390
+
391
+ Additional terms, permissive or non-permissive, may be stated in the
392
+ form of a separately written license, or stated as exceptions;
393
+ the above requirements apply either way.
394
+
395
+ 8. Termination.
396
+
397
+ You may not propagate or modify a covered work except as expressly
398
+ provided under this License. Any attempt otherwise to propagate or
399
+ modify it is void, and will automatically terminate your rights under
400
+ this License (including any patent licenses granted under the third
401
+ paragraph of section 11).
402
+
403
+ However, if you cease all violation of this License, then your
404
+ license from a particular copyright holder is reinstated (a)
405
+ provisionally, unless and until the copyright holder explicitly and
406
+ finally terminates your license, and (b) permanently, if the copyright
407
+ holder fails to notify you of the violation by some reasonable means
408
+ prior to 60 days after the cessation.
409
+
410
+ Moreover, your license from a particular copyright holder is
411
+ reinstated permanently if the copyright holder notifies you of the
412
+ violation by some reasonable means, this is the first time you have
413
+ received notice of violation of this License (for any work) from that
414
+ copyright holder, and you cure the violation prior to 30 days after
415
+ your receipt of the notice.
416
+
417
+ Termination of your rights under this section does not terminate the
418
+ licenses of parties who have received copies or rights from you under
419
+ this License. If your rights have been terminated and not permanently
420
+ reinstated, you do not qualify to receive new licenses for the same
421
+ material under section 10.
422
+
423
+ 9. Acceptance Not Required for Having Copies.
424
+
425
+ You are not required to accept this License in order to receive or
426
+ run a copy of the Program. Ancillary propagation of a covered work
427
+ occurring solely as a consequence of using peer-to-peer transmission
428
+ to receive a copy likewise does not require acceptance. However,
429
+ nothing other than this License grants you permission to propagate or
430
+ modify any covered work. These actions infringe copyright if you do
431
+ not accept this License. Therefore, by modifying or propagating a
432
+ covered work, you indicate your acceptance of this License to do so.
433
+
434
+ 10. Automatic Licensing of Downstream Recipients.
435
+
436
+ Each time you convey a covered work, the recipient automatically
437
+ receives a license from the original licensors, to run, modify and
438
+ propagate that work, subject to this License. You are not responsible
439
+ for enforcing compliance by third parties with this License.
440
+
441
+ An "entity transaction" is a transaction transferring control of an
442
+ organization, or substantially all assets of one, or subdividing an
443
+ organization, or merging organizations. If propagation of a covered
444
+ work results from an entity transaction, each party to that
445
+ transaction who receives a copy of the work also receives whatever
446
+ licenses to the work the party's predecessor in interest had or could
447
+ give under the previous paragraph, plus a right to possession of the
448
+ Corresponding Source of the work from the predecessor in interest, if
449
+ the predecessor has it or can get it with reasonable efforts.
450
+
451
+ You may not impose any further restrictions on the exercise of the
452
+ rights granted or affirmed under this License. For example, you may
453
+ not impose a license fee, royalty, or other charge for exercise of
454
+ rights granted under this License, and you may not initiate litigation
455
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
456
+ any patent claim is infringed by making, using, selling, offering for
457
+ sale, or importing the Program or any portion of it.
458
+
459
+ 11. Patents.
460
+
461
+ A "contributor" is a copyright holder who authorizes use under this
462
+ License of the Program or a work on which the Program is based. The
463
+ work thus licensed is called the contributor's "contributor version".
464
+
465
+ A contributor's "essential patent claims" are all patent claims
466
+ owned or controlled by the contributor, whether already acquired or
467
+ hereafter acquired, that would be infringed by some manner, permitted
468
+ by this License, of making, using, or selling its contributor version,
469
+ but do not include claims that would be infringed only as a
470
+ consequence of further modification of the contributor version. For
471
+ purposes of this definition, "control" includes the right to grant
472
+ patent sublicenses in a manner consistent with the requirements of
473
+ this License.
474
+
475
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
476
+ patent license under the contributor's essential patent claims, to
477
+ make, use, sell, offer for sale, import and otherwise run, modify and
478
+ propagate the contents of its contributor version.
479
+
480
+ In the following three paragraphs, a "patent license" is any express
481
+ agreement or commitment, however denominated, not to enforce a patent
482
+ (such as an express permission to practice a patent or covenant not to
483
+ sue for patent infringement). To "grant" such a patent license to a
484
+ party means to make such an agreement or commitment not to enforce a
485
+ patent against the party.
486
+
487
+ If you convey a covered work, knowingly relying on a patent license,
488
+ and the Corresponding Source of the work is not available for anyone
489
+ to copy, free of charge and under the terms of this License, through a
490
+ publicly available network server or other readily accessible means,
491
+ then you must either (1) cause the Corresponding Source to be so
492
+ available, or (2) arrange to deprive yourself of the benefit of the
493
+ patent license for this particular work, or (3) arrange, in a manner
494
+ consistent with the requirements of this License, to extend the patent
495
+ license to downstream recipients. "Knowingly relying" means you have
496
+ actual knowledge that, but for the patent license, your conveying the
497
+ covered work in a country, or your recipient's use of the covered work
498
+ in a country, would infringe one or more identifiable patents in that
499
+ country that you have reason to believe are valid.
500
+
501
+ If, pursuant to or in connection with a single transaction or
502
+ arrangement, you convey, or propagate by procuring conveyance of, a
503
+ covered work, and grant a patent license to some of the parties
504
+ receiving the covered work authorizing them to use, propagate, modify
505
+ or convey a specific copy of the covered work, then the patent license
506
+ you grant is automatically extended to all recipients of the covered
507
+ work and works based on it.
508
+
509
+ A patent license is "discriminatory" if it does not include within
510
+ the scope of its coverage, prohibits the exercise of, or is
511
+ conditioned on the non-exercise of one or more of the rights that are
512
+ specifically granted under this License. You may not convey a covered
513
+ work if you are a party to an arrangement with a third party that is
514
+ in the business of distributing software, under which you make payment
515
+ to the third party based on the extent of your activity of conveying
516
+ the work, and under which the third party grants, to any of the
517
+ parties who would receive the covered work from you, a discriminatory
518
+ patent license (a) in connection with copies of the covered work
519
+ conveyed by you (or copies made from those copies), or (b) primarily
520
+ for and in connection with specific products or compilations that
521
+ contain the covered work, unless you entered into that arrangement,
522
+ or that patent license was granted, prior to 28 March 2007.
523
+
524
+ Nothing in this License shall be construed as excluding or limiting
525
+ any implied license or other defenses to infringement that may
526
+ otherwise be available to you under applicable patent law.
527
+
528
+ 12. No Surrender of Others' Freedom.
529
+
530
+ If conditions are imposed on you (whether by court order, agreement or
531
+ otherwise) that contradict the conditions of this License, they do not
532
+ excuse you from the conditions of this License. If you cannot convey a
533
+ covered work so as to satisfy simultaneously your obligations under this
534
+ License and any other pertinent obligations, then as a consequence you may
535
+ not convey it at all. For example, if you agree to terms that obligate you
536
+ to collect a royalty for further conveying from those to whom you convey
537
+ the Program, the only way you could satisfy both those terms and this
538
+ License would be to refrain entirely from conveying the Program.
539
+
540
+ 13. Remote Network Interaction; Use with the GNU General Public License.
541
+
542
+ Notwithstanding any other provision of this License, if you modify the
543
+ Program, your modified version must prominently offer all users
544
+ interacting with it remotely through a computer network (if your version
545
+ supports such interaction) an opportunity to receive the Corresponding
546
+ Source of your version by providing access to the Corresponding Source
547
+ from a network server at no charge, through some standard or customary
548
+ means of facilitating copying of software. This Corresponding Source
549
+ shall include the Corresponding Source for any work covered by version 3
550
+ of the GNU General Public License that is incorporated pursuant to the
551
+ following paragraph.
552
+
553
+ Notwithstanding any other provision of this License, you have
554
+ permission to link or combine any covered work with a work licensed
555
+ under version 3 of the GNU General Public License into a single
556
+ combined work, and to convey the resulting work. The terms of this
557
+ License will continue to apply to the part which is the covered work,
558
+ but the work with which it is combined will remain governed by version
559
+ 3 of the GNU General Public License.
560
+
561
+ 14. Revised Versions of this License.
562
+
563
+ The Free Software Foundation may publish revised and/or new versions of
564
+ the GNU Affero General Public License from time to time. Such new versions
565
+ will be similar in spirit to the present version, but may differ in detail to
566
+ address new problems or concerns.
567
+
568
+ Each version is given a distinguishing version number. If the
569
+ Program specifies that a certain numbered version of the GNU Affero General
570
+ Public License "or any later version" applies to it, you have the
571
+ option of following the terms and conditions either of that numbered
572
+ version or of any later version published by the Free Software
573
+ Foundation. If the Program does not specify a version number of the
574
+ GNU Affero General Public License, you may choose any version ever published
575
+ by the Free Software Foundation.
576
+
577
+ If the Program specifies that a proxy can decide which future
578
+ versions of the GNU Affero General Public License can be used, that proxy's
579
+ public statement of acceptance of a version permanently authorizes you
580
+ to choose that version for the Program.
581
+
582
+ Later license versions may give you additional or different
583
+ permissions. However, no additional obligations are imposed on any
584
+ author or copyright holder as a result of your choosing to follow a
585
+ later version.
586
+
587
+ 15. Disclaimer of Warranty.
588
+
589
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597
+
598
+ 16. Limitation of Liability.
599
+
600
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608
+ SUCH DAMAGES.
609
+
610
+ 17. Interpretation of Sections 15 and 16.
611
+
612
+ If the disclaimer of warranty and limitation of liability provided
613
+ above cannot be given local legal effect according to their terms,
614
+ reviewing courts shall apply local law that most closely approximates
615
+ an absolute waiver of all civil liability in connection with the
616
+ Program, unless a warranty or assumption of liability accompanies a
617
+ copy of the Program in return for a fee.
618
+
619
+ END OF TERMS AND CONDITIONS
620
+
621
+ How to Apply These Terms to Your New Programs
622
+
623
+ If you develop a new program, and you want it to be of the greatest
624
+ possible use to the public, the best way to achieve this is to make it
625
+ free software which everyone can redistribute and change under these terms.
626
+
627
+ To do so, attach the following notices to the program. It is safest
628
+ to attach them to the start of each source file to most effectively
629
+ state the exclusion of warranty; and each file should have at least
630
+ the "copyright" line and a pointer to where the full notice is found.
631
+
632
+ <one line to give the program's name and a brief idea of what it does.>
633
+ Copyright (C) <year> <name of author>
634
+
635
+ This program is free software: you can redistribute it and/or modify
636
+ it under the terms of the GNU Affero General Public License as published
637
+ by the Free Software Foundation, either version 3 of the License, or
638
+ (at your option) any later version.
639
+
640
+ This program is distributed in the hope that it will be useful,
641
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
642
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643
+ GNU Affero General Public License for more details.
644
+
645
+ You should have received a copy of the GNU Affero General Public License
646
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
647
+
648
+ Also add information on how to contact you by electronic and paper mail.
649
+
650
+ If your software can interact with users remotely through a computer
651
+ network, you should also make sure that it provides a way for users to
652
+ get its source. For example, if your program is a web application, its
653
+ interface could display a "Source" link that leads users to an archive
654
+ of the code. There are many ways you could offer source, and different
655
+ solutions will be better for different programs; see section 13 for the
656
+ specific requirements.
657
+
658
+ You should also get your employer (if you work as a programmer) or school,
659
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
660
+ For more information on this, and how to apply and follow the GNU AGPL, see
661
+ <https://www.gnu.org/licenses/>.
README-github.md DELETED
@@ -1,127 +0,0 @@
1
- # 🎯 Phonemic Transcription Leaderboard
2
-
3
- Welcome to the Phonemic Transcription Leaderboard! This simple leaderboard helps you track and compare the performance of different speech-to-phoneme model. Feel free to use it for your own hugging face leaderboards!
4
-
5
- ![leaderboard](img/leaderboard.png)
6
-
7
- ## ✨ Features
8
-
9
- * 📊 Interactive leaderboard with real-time sorting
10
- * 🔄 Easy model submission system
11
- * 📈 Automatic evaluation of submitted models
12
- * 📱 Responsive design that works on all devices
13
-
14
- ## 🎯 What This Project Does
15
-
16
- This leaderboard tracks two key metrics for phonemic transcription models:
17
-
18
-
19
- * **PER (Phoneme Error Rate)**: How accurately your model converts speech to phonemes
20
- * **PWED (Phoneme Weighted Edit Distance)**: A more nuanced metric that considers phonemic features
21
-
22
- Read more about evaluations on our [blog](https://www.koellabs.com/blog/phonemic-transcription-metrics)
23
-
24
- Models are evaluated on the TIMIT speech corpus, a gold standard in speech recognition research.
25
-
26
- ## 🚀 Getting Started
27
-
28
- ### Prerequisites
29
-
30
- * Python 3.10
31
- * Git
32
- * A love for speech recognition! 🎤
33
-
34
- ### Quick Installation
35
-
36
- 1. Clone this repository:
37
-
38
- ```bash
39
- git clone [your-repo-url]
40
- cd phonemic-leaderboard
41
- ```
42
-
43
- 2. Set up your environment:
44
-
45
- ```bash
46
- # Create a virtual environment with Python 3.10
47
- python3.10 -m venv venv
48
-
49
- # Activate the virtual environment
50
- source venv/bin/activate
51
-
52
- # Install the required dependencies
53
- pip install -r requirements.txt
54
- ```
55
-
56
- 3. Launch the leaderboard:
57
-
58
- ```bash
59
- # Run the application
60
- uvicorn app:app --host 0.0.0.0 --port 7860
61
- ```
62
-
63
- 4. Visit `http://localhost:7860` in your browser and see the magic! ✨
64
-
65
- ## 🎮 Using the Leaderboard
66
-
67
- ### Submitting a Model
68
-
69
- 1. Go to the "Submit Model" tab
70
- 2. Enter your model details:
71
- * Model name (e.g., "wav2vec2-phoneme-wizard")
72
- * Submission name (e.g., "MyAwesomeModel v1.0")
73
- * GitHub/Kaggle/HuggingFace URL (optional)
74
- 3. Click Submit and watch your model climb the ranks! 🚀
75
-
76
- ### Checking Model Status
77
-
78
- 1. Navigate to the "Model Status" tab
79
- 2. Enter your model name or task ID
80
- 3. Get real-time updates on your model's evaluation progress
81
-
82
- ## 📊 Understanding the Results
83
-
84
- The leaderboard shows:
85
-
86
- * Model names and submission details
87
- * PER and PWED scores (lower is better!)
88
- * Links to model repositories
89
- * Submission dates
90
-
91
- Sort by either metric to see who's leading the pack!
92
-
93
- ## 🛠️ Technical Details
94
-
95
- * Built with Gradio for a smooth UI experience
96
- * Runs on a basic compute plan (16GB RAM, 2vCPUs) for easy reproducibility
97
- * Evaluation can take several hours - perfect time to grab a coffee ☕
98
-
99
- ## 🤝 Contributing
100
-
101
- Want to make this leaderboard even better? We'd love your help! Here are some ways you can contribute:
102
-
103
- * Add new evaluation metrics
104
- * Improve the UI design
105
- * Enhance documentation
106
- * Submit bug fixes
107
- * Add new features
108
-
109
- ## 📝 License
110
-
111
- This project is licensed under the MIT License - see the LICENSE file for details.
112
-
113
- ## 🌟 Acknowledgments
114
-
115
- * Thanks to the TIMIT speech corpus for providing evaluation data
116
- * Shoutout to the [panphon library](https://github.com/dmort27/panphon) for PWED calculations
117
- * Built with love by Koel Labs 💙
118
-
119
- ## 🆘 Need Help?
120
-
121
- Got questions? Found a bug? Want to contribute? Open an issue or reach out to us! We're here to help make speech recognition evaluation fun and accessible for everyone!
122
-
123
- Remember: Every great model deserves its moment to shine! 🌟
124
-
125
- ---
126
-
127
- Happy Transcribing! 🎤✨
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -5,6 +5,103 @@ colorFrom: purple
5
  colorTo: pink
6
  sdk: gradio
7
  sdk_version: 5.8.0
8
- app_file: app.py
9
  pinned: false
10
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  colorTo: pink
6
  sdk: gradio
7
  sdk_version: 5.8.0
8
+ app_file: app/app.py
9
  pinned: false
10
+ ---
11
+
12
+ # 🎯 Phonemic Transcription Leaderboard
13
+
14
+ Welcome to the Phonemic Transcription Leaderboard! This simple leaderboard helps track and compare the performance of different speech-to-phoneme models. Feel free to fork it for your own hugging face leaderboards!
15
+
16
+ ![leaderboard](img/leaderboard.png)
17
+
18
+ ## ✨ Features
19
+
20
+ * 📊 Interactive leaderboard with real-time sorting
21
+ * 🔄 Easy model submission system
22
+ * 📈 Automatic evaluation of submitted models
23
+ * 📱 Responsive design that works on all devices
24
+
25
+ ## 🎯 What This Project Does
26
+
27
+ This leaderboard tracks two key metrics for phonemic transcription models:
28
+
29
+
30
+ * **PER (Phoneme Error Rate)**: How accurately your model converts speech to phonemes
31
+ * **PWED (Phoneme Weighted Edit Distance)**: A more nuanced metric that considers phonemic features
32
+
33
+ Read more about evaluations on our [blog](https://www.koellabs.com/blog/phonemic-transcription-metrics)
34
+
35
+ Models are evaluated on the TIMIT speech corpus, a gold standard in speech recognition research.
36
+
37
+ ## 🚀 Getting Started
38
+
39
+ Navigate to the hosted version on [Hugging Face](https://huggingface.co/spaces/KoelLabs/IPA-Transcription-EN) or follow the instructions in [DEVELOPMENT.md](DEVELOPMENT.md) to run the leaderboard locally.
40
+
41
+ ## 🎮 Using the Leaderboard
42
+
43
+ ### Submitting a Model
44
+
45
+ 1. Go to the "Submit Model" tab
46
+ 2. Enter your model details:
47
+ * Model name (e.g., "wav2vec2-phoneme-wizard")
48
+ * Submission name (e.g., "MyAwesomeModel v1.0")
49
+ * GitHub/Kaggle/HuggingFace URL (optional)
50
+ 3. Click Submit and watch your model climb the ranks! 🚀
51
+
52
+ ### Checking Model Status
53
+
54
+ 1. Navigate to the "Model Status" tab
55
+ 2. Enter your model name or task ID
56
+ 3. Get real-time updates on your model's evaluation progress
57
+
58
+ ## 📊 Understanding the Results
59
+
60
+ The leaderboard shows:
61
+
62
+ * Model names and submission details
63
+ * PER and PWED scores (lower is better!)
64
+ * Links to model repositories
65
+ * Submission dates
66
+
67
+ Sort by either metric to see who's leading the pack!
68
+
69
+ ## 🛠️ Technical Details
70
+
71
+ * Built with Gradio for a smooth UI experience
72
+ * Runs on a basic compute plan (16GB RAM, 2vCPUs) for easy reproducibility
73
+ * Evaluation can take several hours - perfect time to grab a coffee ☕
74
+
75
+ ## 🤝 Contributing
76
+
77
+ Want to make this leaderboard even better? We'd love your help! Here are some ways you can contribute:
78
+
79
+ * Add new evaluation metrics
80
+ * Improve the UI design
81
+ * Enhance documentation
82
+ * Submit bug fixes
83
+ * Add new features
84
+
85
+ Checkout the [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
86
+
87
+ ## 📝 License
88
+
89
+ This project is licensed under the GNU Affero General Public License.
90
+
91
+ We retain all rights to the Koel Labs brand, logos, blog posts and website content.
92
+
93
+ ## 🌟 Acknowledgments
94
+
95
+ * Thanks to the TIMIT speech corpus for providing evaluation data
96
+ * Shoutout to the [panphon library](https://github.com/dmort27/panphon) for PWED calculations
97
+ * Built with love by Koel Labs 💙
98
+
99
+ ## 🆘 Need Help?
100
+
101
+ Got questions? Found a bug? Want to contribute? [Open an issue](https://huggingface.co/spaces/KoelLabs/IPA-Transcription-EN/discussions) or [reach out to us](mailto:[email protected])! We're here to help make speech recognition evaluation fun and accessible for everyone!
102
+
103
+ Remember: Every great model deserves its moment to shine! 🌟
104
+
105
+ ---
106
+
107
+ Happy Transcribing! 🎤✨
__pycache__/app.cpython-310.pyc DELETED
Binary file (2.6 kB)
 
__pycache__/constants.cpython-310.pyc DELETED
Binary file (8.44 kB)
 
__pycache__/init.cpython-310.pyc DELETED
Binary file (3.11 kB)
 
__pycache__/main.cpython-310.pyc DELETED
Binary file (14.2 kB)
 
__pycache__/phone_metrics.cpython-310.pyc DELETED
Binary file (4.16 kB)
 
__pycache__/utils_display.cpython-310.pyc DELETED
Binary file (2.16 kB)
 
app.py → app/app.py RENAMED
@@ -1,184 +1,103 @@
 
 
 
 
1
  import gradio as gr
2
  import pandas as pd
3
- from pathlib import Path
4
- import logging
5
- from datetime import datetime
6
- import sys
7
- import uuid
8
- from typing import Dict, Any
9
- import numpy as np
10
-
11
- # Add parent directory to path to import main
12
- sys.path.append(str(Path(__file__).parent))
13
- from main import (
14
- StorageManager,
15
- EvaluationRequest,
16
- evaluate_model,
17
- PATHS
18
- )
19
-
20
- logging.basicConfig(level=logging.INFO)
21
-
22
- # Initialize storage manager
23
- storage_manager = StorageManager(PATHS)
24
-
25
- def load_leaderboard_data():
26
- try:
27
- return pd.DataFrame(storage_manager.load('leaderboard'))
28
- except Exception as e:
29
- logging.error(f"Error loading leaderboard: {e}")
30
- return pd.DataFrame()
31
 
32
- def format_leaderboard_df(df, sort_by="pwed"):
33
- if df.empty:
34
- return df
35
-
36
- # Sort the original dataframe first
37
- sort_column = "average_per" if sort_by.lower() == "per" else "average_pwed"
38
- df = df.sort_values(by=sort_column, ascending=True) # Ascending=True means smaller values at top
39
-
40
- # Then create display dataframe from the sorted data
41
- display_df = pd.DataFrame({
42
- "Model": df["model"],
43
- "Average PER ⬇️": df["average_per"].apply(lambda x: f"{x:.4f}"),
44
- "Average PWED ⬇️": df["average_pwed"].apply(lambda x: f"{x:.4f}"),
45
- "Link": df["github_url"].apply(lambda x: f'<a href="{x}" target="_blank">Repository</a>' if x else "N/A"),
46
- "Submission Date": pd.to_datetime(df["submission_date"]).dt.strftime("%Y-%m-%d")
47
- })
48
-
49
- return display_df
50
 
51
- def create_html_table(df):
52
- return df.to_html(escape=False, index=False, classes="styled-table")
53
 
54
- def update_leaderboard(sort_option: str) -> str:
55
  try:
56
- df = load_leaderboard_data()
57
- formatted_df = format_leaderboard_df(df, sort_option.lower())
58
- return create_html_table(formatted_df)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  except Exception as e:
60
- logging.error(f"Error updating leaderboard: {e}")
61
  return "Error updating leaderboard"
62
 
63
 
64
  def submit_evaluation(model_name: str, submission_name: str, github_url: str) -> str:
65
  if not model_name or not submission_name:
66
  return "⚠️ Please provide both model name and submission name."
67
-
68
  try:
69
- # Generate a task ID
70
- task_id = str(uuid.uuid4())
71
-
72
- # Create evaluation request
73
- request = EvaluationRequest(
74
- transcription_model=model_name,
75
- submission_name=submission_name,
76
- github_url=github_url if github_url else None,
77
- subset="test"
78
- )
79
-
80
- # Create task entry
81
- task = {
82
- "id": task_id,
83
- "model": model_name,
84
- "subset": "test",
85
- "submission_name": submission_name,
86
- "github_url": github_url,
87
- "status": "queued",
88
- "submitted_at": datetime.now().isoformat()
89
- }
90
-
91
- # Save task
92
- tasks = storage_manager.load('tasks')
93
- tasks.append(task)
94
- storage_manager.save('tasks', tasks)
95
-
96
- # Start evaluation in background
97
- import asyncio
98
- asyncio.run(evaluate_model(task_id, request))
99
-
100
  return f"✅ Evaluation submitted successfully! Task ID: {task_id}"
101
  except Exception as e:
102
  return f"❌ Error: {str(e)}"
103
 
104
- def check_status(query: str) -> Dict[str, Any]:
105
- if not query:
106
- return {"error": "Please enter a model name or task ID"}
107
-
108
- try:
109
- results = storage_manager.load('results')
110
- tasks = storage_manager.load('tasks')
111
-
112
- # First try to find by task ID
113
- result = next((r for r in results if r["task_id"] == query), None)
114
- task = next((t for t in tasks if t["id"] == query), None)
115
-
116
- # If not found, try to find by model name
117
- if not result:
118
- result = next((r for r in results if r["model"] == query), None)
119
- if not task:
120
- task = next((t for t in tasks if t["model"] == query), None)
121
-
122
- if result:
123
- # If we found results, return them
124
- return {
125
- "status": "completed",
126
- "model": result["model"],
127
- "subset": result["subset"],
128
- "num_files": result["num_files"],
129
- "average_per": result["average_per"],
130
- "average_pwed": result["average_pwed"],
131
- "detailed_results": result["detailed_results"],
132
- "timestamp": result["timestamp"]
133
- }
134
- elif task:
135
- # If we only found task status, return that
136
- return task
137
- else:
138
- return {"error": f"No results found for '{query}'"}
139
-
140
- except Exception as e:
141
- logging.error(f"Error checking status: {e}")
142
- return {"error": f"Error checking status: {str(e)}"}
143
-
144
- with gr.Blocks(css="""
145
- .styled-table {
146
- width: 100%;
147
- border-collapse: collapse;
148
- margin: 25px 0;
149
- font-size: 0.9em;
150
- font-family: sans-serif;
151
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
152
- }
153
- .styled-table thead tr {
154
- background: linear-gradient(45deg, #092746, #073562, #0A648F);
155
- color: #ffffff;
156
- text-align: left;
157
- }
158
- .styled-table th,
159
- .styled-table td {
160
- padding: 12px 15px;
161
- }
162
- .styled-table tbody tr {
163
- border-bottom: 1px solid #dddddd;
164
- }
165
- """) as demo:
166
- gr.Markdown("# 🎯 Phonemic Transcription Leaderboard")
167
- gr.Markdown("#### Developed By: Koel Labs")
168
- gr.Markdown("""
169
  ## Explanation of Metrics
170
  - **PER (Phoneme Error Rate)**: The Levenshtein distance calculated between phoneme sequences of the predicted and actual transcriptions.
171
  - **PWED (Phoneme Weighted Edit Distance)**: Edit distance between the predicted and actual phoneme sequences, weighted by the phonemic feature distance. Method by the [panphon library](https://github.com/dmort27/panphon)
172
 
173
  Read more about evaluations on [our blog](https://www.koellabs.com/blog/phonemic-transcription-metrics)
174
- """)
175
- gr.Markdown("""
 
 
176
  ## Test Set Information
177
  The test set used for evaluation is from the [TIMIT speech corpus](https://www.kaggle.com/datasets/mfekadu/darpa-timit-acousticphonetic-continuous-speech). The TIMIT corpus is a widely used dataset for speech recognition research.
178
 
179
  ## Compute
180
  This leaderboard uses the free basic plan (16GB RAM, 2vCPUs) to allow for reproducability. The evaluation may take several hours to complete. Please be patient and do not submit the same model multiple times.
181
- """)
 
 
 
 
182
  with gr.Tabs():
183
  with gr.TabItem("🏆 Leaderboard"):
184
  with gr.Row(elem_classes="controls-row"):
@@ -189,45 +108,51 @@ with gr.Blocks(css="""
189
  interactive=True,
190
  scale=2,
191
  container=False, # Removes the box around the dropdown
192
- label=None # Removes the "Sort by" label
193
  )
194
  refresh_btn = gr.Button("Refresh 🔄", scale=2) # Simplified button text
195
-
196
- leaderboard_html = gr.HTML(create_html_table(format_leaderboard_df(load_leaderboard_data())))
197
  sort_dropdown.change(
198
- fn=update_leaderboard,
199
  inputs=[sort_dropdown],
200
- outputs=leaderboard_html
201
  )
202
  refresh_btn.click(
203
- fn=update_leaderboard,
204
  inputs=[sort_dropdown],
205
- outputs=leaderboard_html
206
  )
207
-
208
  with gr.TabItem("📝 Submit Model"):
209
- model_name = gr.Textbox(label="Model Name", placeholder="facebook/wav2vec2-lv-60-espeak-cv-ft")
210
- submission_name = gr.Textbox(label="Submission Name", placeholder="My Model v1.0")
211
- github_url = gr.Textbox(label="Github/Kaggle/HF URL (optional)", placeholder="https://github.com/username/repo")
 
 
 
 
 
 
 
212
  submit_btn = gr.Button("Submit")
213
  result = gr.Textbox(label="Submission Status")
214
-
215
  submit_btn.click(
216
  fn=submit_evaluation,
217
  inputs=[model_name, submission_name, github_url],
218
- outputs=result
219
  )
220
-
221
  with gr.TabItem("📊 Model Status"):
222
- query = gr.Textbox(label="Model Name or Task ID", placeholder="Enter model name (e.g., facebook/wav2vec2-lv-60-espeak-cv-ft)")
 
 
 
223
  status_btn = gr.Button("Check Status")
224
  status_output = gr.JSON(label="Status")
225
-
226
- status_btn.click(
227
- fn=check_status,
228
- inputs=query,
229
- outputs=status_output
230
- )
231
 
232
  if __name__ == "__main__":
233
- demo.launch()
 
1
+ # This is the main module that handles rendering the Gradio interface.
2
+
3
+ # Note: gradio will automatically create REST API endpoints for the functions that are used as event handlers in the interface.
4
+
5
  import gradio as gr
6
  import pandas as pd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
+ from tasks import start_eval_task, get_leaderboard_data, get_status
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
 
 
 
10
 
11
+ def get_latest_leaderboard_html(sort_option: str) -> str:
12
  try:
13
+ # Get the latest leaderboard data
14
+ df = get_leaderboard_data()
15
+
16
+ # Sort the dataframe so smallest PER or PWED is at the top
17
+ sort_column = "average_per" if sort_option.lower() == "per" else "average_pwed"
18
+ df = df.sort_values(by=sort_column, ascending=True)
19
+
20
+ # Format the dataframe for HTML display
21
+ df = pd.DataFrame(
22
+ {
23
+ "Model": df["model"],
24
+ "Average PER ⬇️": df["average_per"].apply(lambda x: f"{x:.4f}"),
25
+ "Average PWED ⬇️": df["average_pwed"].apply(lambda x: f"{x:.4f}"),
26
+ "Link": df["github_url"].apply(
27
+ lambda x: (
28
+ f'<a href="{x}" target="_blank">Repository</a>' if x else "N/A"
29
+ )
30
+ ),
31
+ "Submission Date": pd.to_datetime(df["submission_date"]).dt.strftime(
32
+ "%Y-%m-%d"
33
+ ),
34
+ }
35
+ )
36
+ return df.to_html(escape=False, index=False, classes="styled-table")
37
  except Exception as e:
38
+ print(f"Error updating leaderboard: {e}")
39
  return "Error updating leaderboard"
40
 
41
 
42
  def submit_evaluation(model_name: str, submission_name: str, github_url: str) -> str:
43
  if not model_name or not submission_name:
44
  return "⚠️ Please provide both model name and submission name."
45
+
46
  try:
47
+ task_id = start_eval_task(model_name, submission_name, github_url)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  return f"✅ Evaluation submitted successfully! Task ID: {task_id}"
49
  except Exception as e:
50
  return f"❌ Error: {str(e)}"
51
 
52
+
53
+ with gr.Blocks(
54
+ css="""
55
+ .styled-table {
56
+ width: 100%;
57
+ border-collapse: collapse;
58
+ margin: 25px 0;
59
+ font-size: 0.9em;
60
+ font-family: sans-serif;
61
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
62
+ }
63
+ .styled-table thead tr {
64
+ background: linear-gradient(45deg, #092746, #073562, #0A648F);
65
+ }
66
+ .styled-table th {
67
+ color: white;
68
+ }
69
+ .styled-table th,
70
+ .styled-table td {
71
+ padding: 12px 15px;
72
+ }
73
+ .styled-table tbody tr {
74
+ border-bottom: 1px solid #dddddd;
75
+ }
76
+ """
77
+ ) as demo:
78
+ gr.Markdown("# 🎯 English Phonemic Transcription Leaderboard")
79
+ gr.Markdown("#### Developed By: [Koel Labs](https://koellabs.com)")
80
+ gr.Markdown(
81
+ """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
  ## Explanation of Metrics
83
  - **PER (Phoneme Error Rate)**: The Levenshtein distance calculated between phoneme sequences of the predicted and actual transcriptions.
84
  - **PWED (Phoneme Weighted Edit Distance)**: Edit distance between the predicted and actual phoneme sequences, weighted by the phonemic feature distance. Method by the [panphon library](https://github.com/dmort27/panphon)
85
 
86
  Read more about evaluations on [our blog](https://www.koellabs.com/blog/phonemic-transcription-metrics)
87
+ """
88
+ )
89
+ gr.Markdown(
90
+ """
91
  ## Test Set Information
92
  The test set used for evaluation is from the [TIMIT speech corpus](https://www.kaggle.com/datasets/mfekadu/darpa-timit-acousticphonetic-continuous-speech). The TIMIT corpus is a widely used dataset for speech recognition research.
93
 
94
  ## Compute
95
  This leaderboard uses the free basic plan (16GB RAM, 2vCPUs) to allow for reproducability. The evaluation may take several hours to complete. Please be patient and do not submit the same model multiple times.
96
+
97
+ ## Contributing, Questions, and Feedback
98
+ Please read the [README.md](https://huggingface.co/spaces/KoelLabs/IPA-Transcription-EN/blob/main/README.md) for more information on how to contribute, ask questions, or provide feedback.
99
+ """
100
+ )
101
  with gr.Tabs():
102
  with gr.TabItem("🏆 Leaderboard"):
103
  with gr.Row(elem_classes="controls-row"):
 
108
  interactive=True,
109
  scale=2,
110
  container=False, # Removes the box around the dropdown
111
+ label=None, # Removes the "Sort by" label
112
  )
113
  refresh_btn = gr.Button("Refresh 🔄", scale=2) # Simplified button text
114
+
115
+ leaderboard_html = gr.HTML(get_latest_leaderboard_html(sort_dropdown.value))
116
  sort_dropdown.change(
117
+ fn=get_latest_leaderboard_html,
118
  inputs=[sort_dropdown],
119
+ outputs=leaderboard_html,
120
  )
121
  refresh_btn.click(
122
+ fn=get_latest_leaderboard_html,
123
  inputs=[sort_dropdown],
124
+ outputs=leaderboard_html,
125
  )
126
+
127
  with gr.TabItem("📝 Submit Model"):
128
+ model_name = gr.Textbox(
129
+ label="Model Name", placeholder="facebook/wav2vec2-lv-60-espeak-cv-ft"
130
+ )
131
+ submission_name = gr.Textbox(
132
+ label="Submission Name", placeholder="My Model v1.0"
133
+ )
134
+ github_url = gr.Textbox(
135
+ label="Github/Kaggle/HF URL (optional)",
136
+ placeholder="https://github.com/username/repo",
137
+ )
138
  submit_btn = gr.Button("Submit")
139
  result = gr.Textbox(label="Submission Status")
140
+
141
  submit_btn.click(
142
  fn=submit_evaluation,
143
  inputs=[model_name, submission_name, github_url],
144
+ outputs=result,
145
  )
146
+
147
  with gr.TabItem("📊 Model Status"):
148
+ query = gr.Textbox(
149
+ label="Model Name or Task ID",
150
+ placeholder="Enter model name (e.g., facebook/wav2vec2-lv-60-espeak-cv-ft)",
151
+ )
152
  status_btn = gr.Button("Check Status")
153
  status_output = gr.JSON(label="Status")
154
+
155
+ status_btn.click(fn=get_status, inputs=query, outputs=status_output)
 
 
 
 
156
 
157
  if __name__ == "__main__":
158
+ demo.launch()
app/data.py ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This module handles the data loading and preprocessing for various phoneme transcription datasets.
2
+
3
+ import torch
4
+ import torchaudio
5
+
6
+ import zipfile
7
+ from pathlib import Path
8
+
9
+ # Get absolute path
10
+ CURRENT_DIR = Path(__file__).parent.absolute()
11
+
12
+ # Constants
13
+ DATA_DIR = CURRENT_DIR / "data"
14
+ TIMIT_PATH = DATA_DIR / "TIMIT.zip"
15
+
16
+
17
+ # Abstract data manager class
18
+ class DataManager:
19
+ """Abstract class for handling dataset operations"""
20
+
21
+ def get_file_list(self, subset: str) -> list[str]:
22
+ """Get list of files for given subset"""
23
+ raise NotImplementedError
24
+
25
+ def load_audio(self, filename: str) -> torch.Tensor:
26
+ """Load and preprocess audio file"""
27
+ raise NotImplementedError
28
+
29
+ def get_phonemes(self, filename: str) -> str:
30
+ """Get phoneme sequence from file"""
31
+ raise NotImplementedError
32
+
33
+
34
+ # Implement datasets
35
+ class TimitDataManager(DataManager):
36
+ """Handles all TIMIT dataset operations"""
37
+
38
+ # TIMIT to IPA mapping with direct simplifications
39
+ _TIMIT_TO_IPA = {
40
+ # Vowels (simplified)
41
+ "aa": "ɑ",
42
+ "ae": "æ",
43
+ "ah": "ʌ",
44
+ "ao": "ɔ",
45
+ "aw": "aʊ",
46
+ "ay": "aɪ",
47
+ "eh": "ɛ",
48
+ "er": "ɹ", # Simplified from 'ɝ'
49
+ "ey": "eɪ",
50
+ "ih": "ɪ",
51
+ "ix": "i", # Simplified from 'ɨ'
52
+ "iy": "i",
53
+ "ow": "oʊ",
54
+ "oy": "ɔɪ",
55
+ "uh": "ʊ",
56
+ "uw": "u",
57
+ "ux": "u", # Simplified from 'ʉ'
58
+ "ax": "ə",
59
+ "ax-h": "ə", # Simplified from 'ə̥'
60
+ "axr": "ɹ", # Simplified from 'ɚ'
61
+ # Consonants
62
+ "b": "",
63
+ "bcl": "b",
64
+ "d": "",
65
+ "dcl": "d",
66
+ "g": "",
67
+ "gcl": "g",
68
+ "p": "",
69
+ "pcl": "p",
70
+ "t": "",
71
+ "tcl": "t",
72
+ "k": "",
73
+ "kcl": "k",
74
+ "dx": "ɾ",
75
+ "q": "ʔ",
76
+ # Fricatives
77
+ "jh": "dʒ",
78
+ "ch": "tʃ",
79
+ "s": "s",
80
+ "sh": "ʃ",
81
+ "z": "z",
82
+ "zh": "ʒ",
83
+ "f": "f",
84
+ "th": "θ",
85
+ "v": "v",
86
+ "dh": "ð",
87
+ "hh": "h",
88
+ "hv": "h", # Simplified from 'ɦ'
89
+ # Nasals (simplified)
90
+ "m": "m",
91
+ "n": "n",
92
+ "ng": "ŋ",
93
+ "em": "m", # Simplified from 'm̩'
94
+ "en": "n", # Simplified from 'n̩'
95
+ "eng": "ŋ", # Simplified from 'ŋ̍'
96
+ "nx": "ɾ", # Simplified from 'ɾ̃'
97
+ # Semivowels and Glides
98
+ "l": "l",
99
+ "r": "ɹ",
100
+ "w": "w",
101
+ "wh": "ʍ",
102
+ "y": "j",
103
+ "el": "l", # Simplified from 'l̩'
104
+ # Special
105
+ "epi": "", # Remove epenthetic silence
106
+ "h#": "", # Remove start/end silence
107
+ "pau": "", # Remove pause
108
+ }
109
+
110
+ def __init__(self, timit_path: Path):
111
+ self.timit_path = timit_path
112
+ self._zip_ = None
113
+ print(f"TimitDataManager initialized with path: {self.timit_path.absolute()}")
114
+ if not self.timit_path.exists():
115
+ raise FileNotFoundError(
116
+ f"TIMIT dataset not found at {self.timit_path.absolute()}. Try running ./scripts/download_data_lfs.sh again."
117
+ )
118
+ else:
119
+ print("TIMIT dataset file exists!")
120
+
121
+ @property
122
+ def _zip(self):
123
+ if not self._zip_:
124
+ self._zip_ = zipfile.ZipFile(self.timit_path, "r")
125
+ return self._zip_
126
+
127
+ def get_file_list(self, subset: str) -> list[str]:
128
+ """Get list of WAV files for given subset"""
129
+ files = [
130
+ f
131
+ for f in self._zip.namelist()
132
+ if f.endswith(".WAV") and subset.lower() in f.lower()
133
+ ]
134
+ print(f"Found {len(files)} WAV files in {subset} subset")
135
+ if files:
136
+ print("First 3 files:", files[:3])
137
+ return files
138
+
139
+ def load_audio(self, filename: str) -> torch.Tensor:
140
+ """Load and preprocess audio file"""
141
+ with self._zip.open(filename) as wav_file:
142
+ waveform, sample_rate = torchaudio.load(wav_file) # type: ignore
143
+
144
+ if waveform.shape[0] > 1:
145
+ waveform = torch.mean(waveform, dim=0, keepdim=True)
146
+
147
+ if sample_rate != 16000:
148
+ waveform = torchaudio.transforms.Resample(sample_rate, 16000)(waveform)
149
+
150
+ waveform = (waveform - waveform.mean()) / (waveform.std() + 1e-7)
151
+
152
+ if waveform.dim() == 1:
153
+ waveform = waveform.unsqueeze(0)
154
+
155
+ return waveform
156
+
157
+ def get_phonemes(self, filename: str) -> str:
158
+ """Get cleaned phoneme sequence from PHN file and convert to IPA"""
159
+ phn_file = filename.replace(".WAV", ".PHN")
160
+ with self._zip.open(phn_file) as f:
161
+ phonemes = []
162
+ for line in f.read().decode("utf-8").splitlines():
163
+ if line.strip():
164
+ _, _, phone = line.split()
165
+ phone = self._remove_stress_mark(phone)
166
+ # Convert to IPA instead of using simplify_timit
167
+ ipa = self._TIMIT_TO_IPA.get(phone.lower(), "")
168
+ if ipa:
169
+ phonemes.append(ipa)
170
+ return "".join(phonemes) # Join without spaces for IPA
171
+
172
+ def _remove_stress_mark(self, text: str) -> str:
173
+ """Removes the combining double inverted breve (͡) from text"""
174
+ if not isinstance(text, str):
175
+ raise TypeError("Input must be string")
176
+ return text.replace("͡", "")
177
+
178
+
179
+ # Initialize data managers
180
+ timit_manager = TimitDataManager(TIMIT_PATH)
{.data → app/data}/TIMIT.zip RENAMED
File without changes
app/inference.py ADDED
@@ -0,0 +1,162 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This module handles model inference and evaluation.
2
+
3
+ from datetime import datetime
4
+ from typing import Optional
5
+
6
+ import torch
7
+ from transformers import AutoProcessor, AutoModelForCTC
8
+
9
+ from data import timit_manager
10
+ from phone_metrics import PhoneErrorMetrics
11
+
12
+ # Initialize evaluation metric
13
+ phone_errors = PhoneErrorMetrics()
14
+
15
+
16
+ class ModelManager:
17
+ """Handles model loading and inference"""
18
+
19
+ def __init__(self):
20
+ self.models = {}
21
+ self.processors = {}
22
+ self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
23
+ self.batch_size = 32
24
+
25
+ def get_model_and_processor(self, model_name: str):
26
+ """Get or load model and processor"""
27
+ if model_name not in self.models:
28
+ print("Loading processor with phoneme tokenizer...")
29
+ processor = AutoProcessor.from_pretrained(model_name)
30
+
31
+ print("Loading model...", {model_name})
32
+ model = AutoModelForCTC.from_pretrained(model_name).to(self.device)
33
+
34
+ self.models[model_name] = model
35
+ self.processors[model_name] = processor
36
+
37
+ return self.models[model_name], self.processors[model_name]
38
+
39
+ def transcribe(self, audio_list: list[torch.Tensor], model_name: str) -> list[str]:
40
+ """Transcribe a batch of audio using specified model"""
41
+ model, processor = self.get_model_and_processor(model_name)
42
+ if not model or not processor:
43
+ raise Exception("Model and processor not loaded")
44
+
45
+ # Process audio in batches
46
+ all_predictions = []
47
+ for i in range(0, len(audio_list), self.batch_size):
48
+ batch_audio = audio_list[i : i + self.batch_size]
49
+
50
+ # Pad sequence within batch
51
+ max_length = max(audio.shape[-1] for audio in batch_audio)
52
+ padded_audio = torch.zeros((len(batch_audio), 1, max_length))
53
+ attention_mask = torch.zeros((len(batch_audio), max_length))
54
+
55
+ for j, audio in enumerate(batch_audio):
56
+ padded_audio[j, :, : audio.shape[-1]] = audio
57
+ attention_mask[j, : audio.shape[-1]] = 1
58
+
59
+ # Process batch
60
+ inputs = processor(
61
+ padded_audio.squeeze(1).numpy(),
62
+ sampling_rate=16000,
63
+ return_tensors="pt",
64
+ padding=True,
65
+ )
66
+
67
+ input_values = inputs.input_values.to(self.device)
68
+ attention_mask = inputs.get("attention_mask", attention_mask).to(
69
+ self.device
70
+ )
71
+
72
+ with torch.no_grad():
73
+ outputs = model(
74
+ input_values=input_values, attention_mask=attention_mask
75
+ )
76
+ logits = outputs.logits
77
+ predicted_ids = torch.argmax(logits, dim=-1)
78
+ predictions = processor.batch_decode(
79
+ predicted_ids, skip_special_tokens=True
80
+ )
81
+ predictions = [pred.replace(" ", "") for pred in predictions]
82
+ all_predictions.extend(predictions)
83
+
84
+ return all_predictions
85
+
86
+
87
+ def evaluate_model(
88
+ model_name: str,
89
+ subset: str = "test",
90
+ max_samples: Optional[int] = None,
91
+ ):
92
+ """Evaluate model on TIMIT dataset"""
93
+
94
+ files = timit_manager.get_file_list(subset)
95
+ if max_samples:
96
+ files = files[:max_samples]
97
+
98
+ results = []
99
+ total_per = total_pwed = 0
100
+
101
+ # Process files in batches
102
+ batch_size = model_manager.batch_size
103
+ for i in range(0, len(files), batch_size):
104
+ batch_files = files[i : i + batch_size]
105
+
106
+ # Load batch audio and ground truth
107
+ batch_audio = []
108
+ batch_ground_truth = []
109
+ for wav_file in batch_files:
110
+ audio = timit_manager.load_audio(wav_file)
111
+ ground_truth = timit_manager.get_phonemes(wav_file)
112
+ batch_audio.append(audio)
113
+ batch_ground_truth.append(ground_truth)
114
+
115
+ # Get predictions for batch
116
+ predictions = model_manager.transcribe(batch_audio, model_name)
117
+
118
+ # Calculate metrics for each file in batch
119
+ for _, (wav_file, prediction, ground_truth) in enumerate(
120
+ zip(batch_files, predictions, batch_ground_truth)
121
+ ):
122
+ metrics = phone_errors.compute(
123
+ predictions=[prediction],
124
+ references=[ground_truth],
125
+ is_normalize_pfer=True,
126
+ )
127
+
128
+ per = metrics["phone_error_rates"][0]
129
+ pwed = metrics["phone_feature_error_rates"][0]
130
+
131
+ results.append(
132
+ {
133
+ "file": wav_file,
134
+ "ground_truth": ground_truth,
135
+ "prediction": prediction,
136
+ "per": per,
137
+ "pwed": pwed,
138
+ }
139
+ )
140
+
141
+ total_per += per
142
+ total_pwed += pwed
143
+
144
+ if not results:
145
+ raise Exception("No files were successfully processed")
146
+
147
+ avg_per = total_per / len(results)
148
+ avg_pwed = total_pwed / len(results)
149
+
150
+ return {
151
+ "model": model_name,
152
+ "subset": subset,
153
+ "num_files": len(results),
154
+ "average_per": avg_per,
155
+ "average_pwed": avg_pwed,
156
+ "detailed_results": results[:5],
157
+ "timestamp": datetime.now().isoformat(),
158
+ }
159
+
160
+
161
+ # Initialize managers
162
+ model_manager = ModelManager()
phone_metrics.py → app/phone_metrics.py RENAMED
@@ -1,5 +1,3 @@
1
- # phone_metrics.py
2
-
3
  """
4
  This module implements phone error metrics based on the work from ginic/phone_errors.
5
  Original implementation: https://huggingface.co/spaces/ginic/phone_errors
@@ -22,12 +20,12 @@ Citation:
22
 
23
  import numpy as np
24
  import panphon.distance
25
- from typing import List, Dict
26
 
27
  class PhoneErrorMetrics:
28
  def __init__(self, feature_model: str = "segment"):
29
  """Initialize the phone error metrics calculator.
30
-
31
  Args:
32
  feature_model (str): panphon feature parsing model ("strict", "permissive", or "segment")
33
  """
@@ -35,17 +33,17 @@ class PhoneErrorMetrics:
35
 
36
  def _phone_error_rate(self, prediction: str, reference: str) -> float:
37
  """Compute phone error rate between prediction and reference.
38
-
39
  Args:
40
  prediction (str): Predicted IPA string
41
  reference (str): Reference IPA string
42
-
43
  Returns:
44
  float: Phone error rate
45
  """
46
  if not reference:
47
  raise ValueError("Reference string cannot be empty")
48
-
49
  pred_phones = self.distance_computer.fm.ipa_segs(prediction)
50
  ref_phones = self.distance_computer.fm.ipa_segs(reference)
51
 
@@ -55,22 +53,24 @@ class PhoneErrorMetrics:
55
  lambda x, y: 0 if x == y else 1, # substitution cost
56
  [[]],
57
  pred_phones,
58
- ref_phones
59
  )
60
 
61
  return phone_edits / len(ref_phones)
62
 
63
- def compute(self,
64
- predictions: List[str],
65
- references: List[str],
66
- is_normalize_pfer: bool = False) -> Dict:
 
 
67
  """Compute phone error metrics between predictions and references.
68
-
69
  Args:
70
  predictions (List[str]): List of predicted IPA strings
71
  references (List[str]): List of reference IPA strings
72
  is_normalize_pfer (bool): Whether to normalize phone feature error rates
73
-
74
  Returns:
75
  Dict containing:
76
  - phone_error_rates: List of PER for each pair
@@ -86,10 +86,12 @@ class PhoneErrorMetrics:
86
 
87
  for pred, ref in zip(predictions, references):
88
  if is_normalize_pfer:
89
- hd = self.distance_computer.hamming_feature_edit_distance_div_maxlen(pred, ref)
 
 
90
  else:
91
  hd = self.distance_computer.hamming_feature_edit_distance(pred, ref)
92
-
93
  hamming_distances.append(hd)
94
  per = self._phone_error_rate(pred, ref)
95
  phone_error_rates.append(per)
@@ -102,5 +104,5 @@ class PhoneErrorMetrics:
102
  "phone_feature_error_rates": hamming_distances,
103
  "mean_phone_feature_error_rate": float(np.mean(hamming_distances)),
104
  "feature_error_rates": feature_error_rates,
105
- "mean_feature_error_rate": float(np.mean(feature_error_rates))
106
- }
 
 
 
1
  """
2
  This module implements phone error metrics based on the work from ginic/phone_errors.
3
  Original implementation: https://huggingface.co/spaces/ginic/phone_errors
 
20
 
21
  import numpy as np
22
  import panphon.distance
23
+
24
 
25
  class PhoneErrorMetrics:
26
  def __init__(self, feature_model: str = "segment"):
27
  """Initialize the phone error metrics calculator.
28
+
29
  Args:
30
  feature_model (str): panphon feature parsing model ("strict", "permissive", or "segment")
31
  """
 
33
 
34
  def _phone_error_rate(self, prediction: str, reference: str) -> float:
35
  """Compute phone error rate between prediction and reference.
36
+
37
  Args:
38
  prediction (str): Predicted IPA string
39
  reference (str): Reference IPA string
40
+
41
  Returns:
42
  float: Phone error rate
43
  """
44
  if not reference:
45
  raise ValueError("Reference string cannot be empty")
46
+
47
  pred_phones = self.distance_computer.fm.ipa_segs(prediction)
48
  ref_phones = self.distance_computer.fm.ipa_segs(reference)
49
 
 
53
  lambda x, y: 0 if x == y else 1, # substitution cost
54
  [[]],
55
  pred_phones,
56
+ ref_phones,
57
  )
58
 
59
  return phone_edits / len(ref_phones)
60
 
61
+ def compute(
62
+ self,
63
+ predictions: list[str],
64
+ references: list[str],
65
+ is_normalize_pfer: bool = False,
66
+ ) -> dict:
67
  """Compute phone error metrics between predictions and references.
68
+
69
  Args:
70
  predictions (List[str]): List of predicted IPA strings
71
  references (List[str]): List of reference IPA strings
72
  is_normalize_pfer (bool): Whether to normalize phone feature error rates
73
+
74
  Returns:
75
  Dict containing:
76
  - phone_error_rates: List of PER for each pair
 
86
 
87
  for pred, ref in zip(predictions, references):
88
  if is_normalize_pfer:
89
+ hd = self.distance_computer.hamming_feature_edit_distance_div_maxlen(
90
+ pred, ref
91
+ )
92
  else:
93
  hd = self.distance_computer.hamming_feature_edit_distance(pred, ref)
94
+
95
  hamming_distances.append(hd)
96
  per = self._phone_error_rate(pred, ref)
97
  phone_error_rates.append(per)
 
104
  "phone_feature_error_rates": hamming_distances,
105
  "mean_phone_feature_error_rate": float(np.mean(hamming_distances)),
106
  "feature_error_rates": feature_error_rates,
107
+ "mean_feature_error_rate": float(np.mean(feature_error_rates)),
108
+ }
{queue → app/queue}/leaderboard.json RENAMED
File without changes
{queue → app/queue}/results.json RENAMED
File without changes
{queue → app/queue}/tasks.json RENAMED
File without changes
app/tasks.py ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This modules handles the task queue, results, and leaderboard storage.
2
+
3
+ import json
4
+ import uuid
5
+ from datetime import datetime
6
+ from pathlib import Path
7
+ from typing import Optional
8
+
9
+ import asyncio
10
+ import pandas as pd
11
+
12
+ from inference import evaluate_model
13
+
14
+ # Get absolute path
15
+ CURRENT_DIR = Path(__file__).parent.absolute()
16
+
17
+ # Constants
18
+ QUEUE_DIR = CURRENT_DIR / "queue"
19
+ PATHS = {
20
+ "tasks": QUEUE_DIR / "tasks.json",
21
+ "results": QUEUE_DIR / "results.json",
22
+ "leaderboard": QUEUE_DIR / "leaderboard.json",
23
+ }
24
+
25
+
26
+ # Handle storing and loading data from JSON files
27
+ class StorageManager:
28
+ """Handles all JSON storage operations"""
29
+
30
+ def __init__(self, paths: dict[str, Path]):
31
+ self.paths = paths
32
+ self._ensure_directories()
33
+
34
+ def _ensure_directories(self):
35
+ """Ensure all necessary directories and files exist"""
36
+ for path in self.paths.values():
37
+ path.parent.mkdir(parents=True, exist_ok=True)
38
+ if not path.exists():
39
+ path.write_text("[]")
40
+
41
+ def load(self, key: str) -> list:
42
+ """Load JSON file"""
43
+ return json.loads(self.paths[key].read_text())
44
+
45
+ def save(self, key: str, data: list):
46
+ """Save data to JSON file"""
47
+ self.paths[key].write_text(
48
+ json.dumps(data, indent=4, default=str, ensure_ascii=False)
49
+ )
50
+
51
+ def update_task(self, task_id: str, updates: dict):
52
+ """Update specific task with new data"""
53
+ tasks = self.load("tasks")
54
+ for task in tasks:
55
+ if task["id"] == task_id:
56
+ task.update(updates)
57
+ break
58
+ self.save("tasks", tasks)
59
+
60
+
61
+ # Initialize storage manager
62
+ storage_manager = StorageManager(PATHS)
63
+
64
+
65
+ # Export external functions
66
+ def get_leaderboard_data():
67
+ """Return leaderboard data as DataFrame"""
68
+ try:
69
+ return pd.DataFrame(storage_manager.load("leaderboard"))
70
+ except Exception as e:
71
+ print(f"Error loading leaderboard: {e}")
72
+ return pd.DataFrame()
73
+
74
+
75
+ def get_results():
76
+ """Return list of evaluation results"""
77
+ return storage_manager.load("results")
78
+
79
+
80
+ def get_tasks():
81
+ """Return list of tasks"""
82
+ return storage_manager.load("tasks")
83
+
84
+
85
+ def get_status(query: str) -> dict:
86
+ """Check status of a model evaluation task_id or model_name"""
87
+ if not query:
88
+ return {"error": "Please enter a model name or task ID"}
89
+
90
+ try:
91
+ results = get_results()
92
+ tasks = get_tasks()
93
+
94
+ # First try to find by task ID
95
+ result = next((r for r in results if r["task_id"] == query), None)
96
+ task = next((t for t in tasks if t["id"] == query), None)
97
+
98
+ # If not found, try to find by model name
99
+ if not result:
100
+ result = next((r for r in results if r["model"] == query), None)
101
+ if not task:
102
+ task = next((t for t in tasks if t["model"] == query), None)
103
+
104
+ if result:
105
+ # If we found results, return them
106
+ return {
107
+ "status": "completed",
108
+ "model": result["model"],
109
+ "subset": result["subset"],
110
+ "num_files": result["num_files"],
111
+ "average_per": result["average_per"],
112
+ "average_pwed": result["average_pwed"],
113
+ "detailed_results": result["detailed_results"],
114
+ "timestamp": result["timestamp"],
115
+ }
116
+ elif task:
117
+ # If we only found task status, return that
118
+ return task
119
+ else:
120
+ return {"error": f"No results found for '{query}'"}
121
+
122
+ except Exception as e:
123
+ print(f"Error checking status: {e}")
124
+ return {"error": f"Error checking status: {str(e)}"}
125
+
126
+
127
+ def start_eval_task(
128
+ model_name: str, submission_name: str, github_url: Optional[str] = None
129
+ ) -> str:
130
+ """Start evaluation task in background. Returns task ID that can be used to check status."""
131
+
132
+ # Generate a task ID
133
+ task_id = str(uuid.uuid4())
134
+
135
+ # Create task entry
136
+ task = {
137
+ "id": task_id,
138
+ "model": model_name,
139
+ "subset": "test",
140
+ "submission_name": submission_name,
141
+ "github_url": github_url,
142
+ "status": "queued",
143
+ "submitted_at": datetime.now().isoformat(),
144
+ }
145
+
146
+ # Save task
147
+ tasks = storage_manager.load("tasks")
148
+ tasks.append(task)
149
+ storage_manager.save("tasks", tasks)
150
+
151
+ # Start evaluation in background
152
+ asyncio.run(_eval_task(task_id, model_name, submission_name, "test", github_url))
153
+
154
+ return task_id
155
+
156
+
157
+ async def _eval_task(
158
+ task_id: str,
159
+ model_name: str,
160
+ submission_name: str,
161
+ subset: str = "test",
162
+ github_url: Optional[str] = None,
163
+ max_samples: Optional[int] = None,
164
+ ):
165
+ """Background task to evaluate model and save updated results"""
166
+ try:
167
+ # Indicate task is processing
168
+ storage_manager.update_task(task_id, {"status": "processing"})
169
+
170
+ # Evaluate model
171
+ result = evaluate_model(model_name, subset, max_samples)
172
+ avg_per = result["average_per"]
173
+ avg_pwed = result["average_pwed"]
174
+
175
+ # Save results
176
+ print("Saving results...")
177
+ current_results = storage_manager.load("results")
178
+ current_results.append(result)
179
+ storage_manager.save("results", current_results)
180
+
181
+ # Update leaderboard
182
+ print("Updating leaderboard...")
183
+ leaderboard = storage_manager.load("leaderboard")
184
+ entry = next(
185
+ (e for e in leaderboard if e["submission_name"] == submission_name),
186
+ None,
187
+ )
188
+
189
+ if entry:
190
+ # Simply update with new scores
191
+ entry.update(
192
+ {
193
+ "task_id": task_id,
194
+ "average_per": avg_per,
195
+ "average_pwed": avg_pwed,
196
+ "model": model_name,
197
+ "subset": subset,
198
+ "github_url": github_url,
199
+ "submission_date": datetime.now().isoformat(),
200
+ }
201
+ )
202
+ else:
203
+ leaderboard.append(
204
+ {
205
+ "task_id": task_id,
206
+ "submission_id": str(uuid.uuid4()),
207
+ "submission_name": submission_name,
208
+ "model": model_name,
209
+ "average_per": avg_per,
210
+ "average_pwed": avg_pwed,
211
+ "subset": subset,
212
+ "github_url": github_url,
213
+ "submission_date": datetime.now().isoformat(),
214
+ }
215
+ )
216
+
217
+ storage_manager.save("leaderboard", leaderboard)
218
+ storage_manager.update_task(task_id, {"status": "completed"})
219
+ print("Evaluation completed successfully")
220
+
221
+ except Exception as e:
222
+ error_msg = f"Evaluation failed: {str(e)}"
223
+ print(error_msg)
224
+ storage_manager.update_task(task_id, {"status": "failed", "error": error_msg})
assets/.DS_Store DELETED
Binary file (6.15 kB)
 
init.py DELETED
@@ -1,92 +0,0 @@
1
- import os
2
- from constants import EVAL_REQUESTS_PATH
3
- from pathlib import Path
4
- from huggingface_hub import HfApi, Repository
5
-
6
- TOKEN_HUB = os.environ.get("TOKEN_HUB", None)
7
- QUEUE_REPO = os.environ.get("QUEUE_REPO", None)
8
- QUEUE_PATH = os.environ.get("QUEUE_PATH", None)
9
-
10
- hf_api = HfApi(
11
- endpoint="https://huggingface.co",
12
- token=TOKEN_HUB,
13
- )
14
-
15
- def load_all_info_from_dataset_hub():
16
- eval_queue_repo = None
17
- requested_models = None
18
-
19
- passed = True
20
- if TOKEN_HUB is None:
21
- passed = False
22
- else:
23
- print("Pulling evaluation requests and results.")
24
-
25
- eval_queue_repo = Repository(
26
- local_dir=QUEUE_PATH,
27
- clone_from=QUEUE_REPO,
28
- use_auth_token=TOKEN_HUB,
29
- repo_type="dataset",
30
- )
31
- eval_queue_repo.git_pull()
32
-
33
- # Local directory where dataset repo is cloned + folder with eval requests
34
- directory = QUEUE_PATH / EVAL_REQUESTS_PATH
35
- requested_models = get_all_requested_models(directory)
36
- requested_models = [p.stem for p in requested_models]
37
- # Local directory where dataset repo is cloned
38
- csv_results = get_csv_with_results(QUEUE_PATH)
39
- if csv_results is None:
40
- passed = False
41
- if not passed:
42
- raise ValueError("No Hugging Face token provided. Skipping evaluation requests and results.")
43
-
44
- return eval_queue_repo, requested_models, csv_results
45
-
46
-
47
- def upload_file(requested_model_name, path_or_fileobj):
48
- dest_repo_file = Path(EVAL_REQUESTS_PATH) / path_or_fileobj.name
49
- dest_repo_file = str(dest_repo_file)
50
- hf_api.upload_file(
51
- path_or_fileobj=path_or_fileobj,
52
- path_in_repo=str(dest_repo_file),
53
- repo_id=QUEUE_REPO,
54
- token=TOKEN_HUB,
55
- repo_type="dataset",
56
- commit_message=f"Add {requested_model_name} to eval queue")
57
-
58
- def get_all_requested_models(directory):
59
- directory = Path(directory)
60
- all_requested_models = list(directory.glob("*.txt"))
61
- return all_requested_models
62
-
63
- def get_csv_with_results(directory):
64
- directory = Path(directory)
65
- all_csv_files = list(directory.glob("*.csv"))
66
- latest = [f for f in all_csv_files if f.stem.endswith("latest")]
67
- if len(latest) != 1:
68
- return None
69
- return latest[0]
70
-
71
-
72
-
73
- def is_model_on_hub(model_name, revision="main") -> bool:
74
- try:
75
- model_name = model_name.replace(" ","")
76
- author = model_name.split("/")[0]
77
- model_id = model_name.split("/")[1]
78
- if len(author) == 0 or len(model_id) == 0:
79
- return False, "is not a valid model name. Please use the format `author/model_name`."
80
- except Exception as e:
81
- return False, "is not a valid model name. Please use the format `author/model_name`."
82
-
83
- try:
84
- models = list(hf_api.list_models(author=author, search=model_id))
85
- matched = [model_name for m in models if m.modelId == model_name]
86
- if len(matched) != 1:
87
- return False, "was not found on the hub!"
88
- else:
89
- return True, None
90
- except Exception as e:
91
- print(f"Could not get the model from the hub.: {e}")
92
- return False, "was not found on hub!"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
main.py DELETED
@@ -1,505 +0,0 @@
1
- import gradio as gr
2
- from fastapi import FastAPI, HTTPException, BackgroundTasks
3
- from pydantic import BaseModel, HttpUrl
4
- from typing import List, Optional, Dict
5
- import torch
6
- import torchaudio
7
- from transformers import AutoProcessor, AutoModelForCTC
8
- import evaluate
9
- import zipfile
10
- from datetime import datetime
11
- import json
12
- import uuid
13
- import os
14
- from pathlib import Path
15
- from huggingface_hub import HfApi
16
- import evaluate
17
- from phone_metrics import PhoneErrorMetrics
18
-
19
- # Set up download configuration with your token
20
-
21
- app = FastAPI(title="TIMIT Phoneme Transcription Leaderboard")
22
-
23
- # Create Gradio interface
24
- demo = gr.Interface(
25
- fn=lambda x: x,
26
- inputs=gr.Textbox(visible=False),
27
- outputs=gr.Textbox(visible=False),
28
- title="TIMIT Phoneme Transcription Queue",
29
- description="API endpoints are available at /api/leaderboard, /api/evaluate, and /api/tasks/{task_id}"
30
- )
31
-
32
-
33
- # Get absolute path - Updated for HF Spaces
34
- CURRENT_DIR = Path(__file__).parent.absolute()
35
-
36
- # Constants - Updated for HF Spaces environment
37
- TIMIT_PATH = CURRENT_DIR / ".data" / "TIMIT.zip" # Move TIMIT.zip to root of space
38
- QUEUE_DIR = CURRENT_DIR / "queue"
39
- PATHS = {
40
- 'tasks': QUEUE_DIR / "tasks.json",
41
- 'results': QUEUE_DIR / "results.json",
42
- 'leaderboard': QUEUE_DIR / "leaderboard.json"
43
- }
44
-
45
- # Initialize evaluation metric
46
- phone_errors = PhoneErrorMetrics()
47
-
48
-
49
- class TimitDataManager:
50
- """Handles all TIMIT dataset operations"""
51
-
52
- # TIMIT to IPA mapping with direct simplifications
53
- TIMIT_TO_IPA = {
54
- # Vowels (simplified)
55
- 'aa': 'ɑ',
56
- 'ae': 'æ',
57
- 'ah': 'ʌ',
58
- 'ao': 'ɔ',
59
- 'aw': 'aʊ',
60
- 'ay': 'aɪ',
61
- 'eh': 'ɛ',
62
- 'er': 'ɹ', # Simplified from 'ɝ'
63
- 'ey': 'eɪ',
64
- 'ih': 'ɪ',
65
- 'ix': 'i', # Simplified from 'ɨ'
66
- 'iy': 'i',
67
- 'ow': 'oʊ',
68
- 'oy': 'ɔɪ',
69
- 'uh': 'ʊ',
70
- 'uw': 'u',
71
- 'ux': 'u', # Simplified from 'ʉ'
72
- 'ax': 'ə',
73
- 'ax-h': 'ə', # Simplified from 'ə̥'
74
- 'axr': 'ɹ', # Simplified from 'ɚ'
75
-
76
- # Consonants
77
- 'b': '',
78
- 'bcl': 'b',
79
- 'd': '',
80
- 'dcl': 'd',
81
- 'g': '',
82
- 'gcl': 'g',
83
- 'p': '',
84
- 'pcl': 'p',
85
- 't': '',
86
- 'tcl': 't',
87
- 'k': '',
88
- 'kcl': 'k',
89
- 'dx': 'ɾ',
90
- 'q': 'ʔ',
91
-
92
- # Fricatives
93
- 'jh': 'dʒ',
94
- 'ch': 'tʃ',
95
- 's': 's',
96
- 'sh': 'ʃ',
97
- 'z': 'z',
98
- 'zh': 'ʒ',
99
- 'f': 'f',
100
- 'th': 'θ',
101
- 'v': 'v',
102
- 'dh': 'ð',
103
- 'hh': 'h',
104
- 'hv': 'h', # Simplified from 'ɦ'
105
-
106
- # Nasals (simplified)
107
- 'm': 'm',
108
- 'n': 'n',
109
- 'ng': 'ŋ',
110
- 'em': 'm', # Simplified from 'm̩'
111
- 'en': 'n', # Simplified from 'n̩'
112
- 'eng': 'ŋ', # Simplified from 'ŋ̍'
113
- 'nx': 'ɾ', # Simplified from 'ɾ̃'
114
-
115
- # Semivowels and Glides
116
- 'l': 'l',
117
- 'r': 'ɹ',
118
- 'w': 'w',
119
- 'wh': 'ʍ',
120
- 'y': 'j',
121
- 'el': 'l', # Simplified from 'l̩'
122
-
123
- # Special
124
- 'epi': '', # Remove epenthetic silence
125
- 'h#': '', # Remove start/end silence
126
- 'pau': '', # Remove pause
127
- }
128
-
129
-
130
- def __init__(self, timit_path: Path):
131
- self.timit_path = timit_path
132
- self._zip = None
133
- print(f"TimitDataManager initialized with path: {self.timit_path.absolute()}")
134
- if not self.timit_path.exists():
135
- raise FileNotFoundError(f"TIMIT dataset not found at {self.timit_path.absolute()}")
136
- print("TIMIT dataset file exists!")
137
-
138
- @property
139
- def zip(self):
140
- if not self._zip:
141
- try:
142
- self._zip = zipfile.ZipFile(self.timit_path, 'r')
143
- print("Successfully opened TIMIT zip file")
144
- except FileNotFoundError:
145
- raise FileNotFoundError(f"TIMIT dataset not found at {self.timit_path}")
146
- return self._zip
147
-
148
- def get_file_list(self, subset: str) -> List[str]:
149
- """Get list of WAV files for given subset"""
150
- files = [f for f in self.zip.namelist()
151
- if f.endswith('.WAV') and subset.lower() in f.lower()]
152
- print(f"Found {len(files)} WAV files in {subset} subset")
153
- if files:
154
- print("First 3 files:", files[:3])
155
- return files
156
-
157
- def load_audio(self, filename: str) -> torch.Tensor:
158
- """Load and preprocess audio file"""
159
- with self.zip.open(filename) as wav_file:
160
- waveform, sample_rate = torchaudio.load(wav_file)
161
-
162
- if waveform.shape[0] > 1:
163
- waveform = torch.mean(waveform, dim=0, keepdim=True)
164
-
165
- if sample_rate != 16000:
166
- waveform = torchaudio.transforms.Resample(sample_rate, 16000)(waveform)
167
-
168
- waveform = (waveform - waveform.mean()) / (waveform.std() + 1e-7)
169
-
170
- if waveform.dim() == 1:
171
- waveform = waveform.unsqueeze(0)
172
-
173
- return waveform
174
-
175
- def get_phonemes(self, filename: str) -> str:
176
- """Get cleaned phoneme sequence from PHN file and convert to IPA"""
177
- phn_file = filename.replace('.WAV', '.PHN')
178
- with self.zip.open(phn_file) as f:
179
- phonemes = []
180
- for line in f.read().decode('utf-8').splitlines():
181
- if line.strip():
182
- _, _, phone = line.split()
183
- phone = self.remove_stress_mark(phone)
184
- # Convert to IPA instead of using simplify_timit
185
- ipa = self.TIMIT_TO_IPA.get(phone.lower(), '')
186
- if ipa:
187
- phonemes.append(ipa)
188
- return ''.join(phonemes) # Join without spaces for IPA
189
-
190
- def simplify_timit(self, phoneme: str) -> str:
191
- """Apply substitutions to simplify TIMIT phonemes"""
192
- return self.PHONE_SUBSTITUTIONS.get(phoneme, phoneme)
193
-
194
- def remove_stress_mark(self, text: str) -> str:
195
- """Removes the combining double inverted breve (͡) from text"""
196
- if not isinstance(text, str):
197
- raise TypeError("Input must be string")
198
- return text.replace('͡', '')
199
-
200
- class ModelManager:
201
- """Handles model loading and inference"""
202
-
203
- def __init__(self):
204
- self.models = {}
205
- self.processors = {}
206
- self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
207
- self.batch_size = 32 # Added batch size parameter
208
-
209
- def get_model_and_processor(self, model_name: str):
210
- """Get or load model and processor"""
211
- if model_name not in self.models:
212
- print("Loading processor with phoneme tokenizer...")
213
- processor = AutoProcessor.from_pretrained(model_name)
214
-
215
- print("Loading model...", {model_name})
216
- model = AutoModelForCTC.from_pretrained(model_name).to(self.device)
217
-
218
- self.models[model_name] = model
219
- self.processors[model_name] = processor
220
-
221
- return self.models[model_name], self.processors[model_name]
222
-
223
- def transcribe(self, audio_list: List[torch.Tensor], model_name: str) -> List[str]:
224
- """Transcribe a batch of audio using specified model"""
225
- model, processor = self.get_model_and_processor(model_name)
226
- if not model or not processor:
227
- raise Exception("Model and processor not loaded")
228
-
229
- # Process audio in batches
230
- all_predictions = []
231
- for i in range(0, len(audio_list), self.batch_size):
232
- batch_audio = audio_list[i:i + self.batch_size]
233
-
234
- # Pad sequence within batch
235
- max_length = max(audio.shape[-1] for audio in batch_audio)
236
- padded_audio = torch.zeros((len(batch_audio), 1, max_length))
237
- attention_mask = torch.zeros((len(batch_audio), max_length))
238
-
239
- for j, audio in enumerate(batch_audio):
240
- padded_audio[j, :, :audio.shape[-1]] = audio
241
- attention_mask[j, :audio.shape[-1]] = 1
242
-
243
- # Process batch
244
- inputs = processor(
245
- padded_audio.squeeze(1).numpy(),
246
- sampling_rate=16000,
247
- return_tensors="pt",
248
- padding=True
249
- )
250
-
251
- input_values = inputs.input_values.to(self.device)
252
- attention_mask = inputs.get("attention_mask", attention_mask).to(self.device)
253
-
254
- with torch.no_grad():
255
- outputs = model(
256
- input_values=input_values,
257
- attention_mask=attention_mask
258
- )
259
- logits = outputs.logits
260
- predicted_ids = torch.argmax(logits, dim=-1)
261
- predictions = processor.batch_decode(predicted_ids, skip_special_tokens=True)
262
- predictions = [pred.replace(' ', '') for pred in predictions]
263
- all_predictions.extend(predictions)
264
-
265
- return all_predictions
266
-
267
- class StorageManager:
268
- """Handles all JSON storage operations"""
269
-
270
- def __init__(self, paths: Dict[str, Path]):
271
- self.paths = paths
272
- self._ensure_directories()
273
-
274
- def _ensure_directories(self):
275
- """Ensure all necessary directories and files exist"""
276
- for path in self.paths.values():
277
- path.parent.mkdir(parents=True, exist_ok=True)
278
- if not path.exists():
279
- path.write_text('[]')
280
-
281
- def load(self, key: str) -> List:
282
- """Load JSON file"""
283
- return json.loads(self.paths[key].read_text())
284
-
285
- def save(self, key: str, data: List):
286
- """Save data to JSON file"""
287
- self.paths[key].write_text(json.dumps(data, indent=4, default=str, ensure_ascii=False))
288
-
289
- def update_task(self, task_id: str, updates: Dict):
290
- """Update specific task with new data"""
291
- tasks = self.load('tasks')
292
- for task in tasks:
293
- if task['id'] == task_id:
294
- task.update(updates)
295
- break
296
- self.save('tasks', tasks)
297
-
298
- class EvaluationRequest(BaseModel):
299
- """Request model for TIMIT evaluation"""
300
- transcription_model: str
301
- subset: str = "timit-test"
302
- max_samples: Optional[int] = None
303
- submission_name: str
304
- github_url: Optional[str] = None
305
-
306
- # Initialize managers
307
- timit_manager = TimitDataManager(TIMIT_PATH)
308
- model_manager = ModelManager()
309
- storage_manager = StorageManager(PATHS)
310
-
311
- async def evaluate_model(task_id: str, request: EvaluationRequest):
312
- """Background task to evaluate model on TIMIT"""
313
- try:
314
- storage_manager.update_task(task_id, {"status": "processing"})
315
-
316
- files = timit_manager.get_file_list(request.subset)
317
- if request.max_samples:
318
- files = files[:request.max_samples]
319
-
320
- results = []
321
- total_per = total_pwed = 0
322
-
323
- # Process files in batches
324
- batch_size = model_manager.batch_size
325
- for i in range(0, len(files), batch_size):
326
- batch_files = files[i:i + batch_size]
327
-
328
- # Load batch audio and ground truth
329
- batch_audio = []
330
- batch_ground_truth = []
331
- for wav_file in batch_files:
332
- audio = timit_manager.load_audio(wav_file)
333
- ground_truth = timit_manager.get_phonemes(wav_file)
334
- batch_audio.append(audio)
335
- batch_ground_truth.append(ground_truth)
336
-
337
- # Get predictions for batch
338
- predictions = model_manager.transcribe(batch_audio, request.transcription_model)
339
-
340
- # Calculate metrics for each file in batch
341
- for j, (wav_file, prediction, ground_truth) in enumerate(zip(batch_files, predictions, batch_ground_truth)):
342
- # Convert Unicode to readable format
343
- #prediction_str = repr(prediction)[1:-1] # Remove quotes but keep escaped unicode
344
-
345
- metrics = phone_errors.compute(
346
- predictions=[prediction],
347
- references=[ground_truth],
348
- is_normalize_pfer=True
349
- )
350
-
351
- per = metrics['phone_error_rates'][0]
352
- pwed = metrics['phone_feature_error_rates'][0]
353
-
354
- results.append({
355
- "file": wav_file,
356
- "ground_truth": ground_truth,
357
- "prediction": prediction,
358
- "per": per,
359
- "pwed": pwed
360
- })
361
-
362
- total_per += per
363
- total_pwed += pwed
364
-
365
- if not results:
366
- raise Exception("No files were successfully processed")
367
-
368
- avg_per = total_per / len(results)
369
- avg_pwed = total_pwed / len(results)
370
-
371
- result = {
372
- "task_id": task_id,
373
- "model": request.transcription_model,
374
- "subset": request.subset,
375
- "num_files": len(results),
376
- "average_per": avg_per,
377
- "average_pwed": avg_pwed,
378
- "detailed_results": results[:5],
379
- "timestamp": datetime.now().isoformat()
380
- }
381
-
382
- # Save results
383
- print("Saving results...")
384
- current_results = storage_manager.load('results')
385
- current_results.append(result)
386
- storage_manager.save('results', current_results)
387
-
388
- # Update leaderboard
389
- print("Updating leaderboard...")
390
- leaderboard = storage_manager.load('leaderboard')
391
- entry = next((e for e in leaderboard
392
- if e["submission_name"] == request.submission_name), None)
393
-
394
- if entry:
395
- # Simply update with new scores
396
- entry.update({
397
- "average_per": avg_per,
398
- "average_pwed": avg_pwed,
399
- "model": request.transcription_model,
400
- "subset": request.subset,
401
- "github_url": request.github_url,
402
- "submission_date": datetime.now().isoformat()
403
- })
404
- else:
405
- leaderboard.append({
406
- "submission_id": str(uuid.uuid4()),
407
- "submission_name": request.submission_name,
408
- "model": request.transcription_model,
409
- "average_per": avg_per,
410
- "average_pwed": avg_pwed,
411
- "subset": request.subset,
412
- "github_url": request.github_url,
413
- "submission_date": datetime.now().isoformat()
414
- })
415
-
416
- storage_manager.save('leaderboard', leaderboard)
417
- storage_manager.update_task(task_id, {"status": "completed"})
418
- print("Evaluation completed successfully")
419
-
420
- except Exception as e:
421
- error_msg = f"Evaluation failed: {str(e)}"
422
- print(error_msg)
423
- storage_manager.update_task(task_id, {
424
- "status": "failed",
425
- "error": error_msg
426
- })
427
-
428
- # Initialize managers
429
- def init_directories():
430
- """Ensure all necessary directories exist"""
431
- (CURRENT_DIR / ".data").mkdir(parents=True, exist_ok=True)
432
- QUEUE_DIR.mkdir(parents=True, exist_ok=True)
433
-
434
- for path in PATHS.values():
435
- if not path.exists():
436
- path.write_text('[]')
437
-
438
- # Initialize your managers
439
- init_directories() # Your existing initialization function
440
- timit_manager = TimitDataManager(TIMIT_PATH)
441
- model_manager = ModelManager()
442
- storage_manager = StorageManager(PATHS)
443
-
444
- @app.get("/api/health")
445
- async def health_check():
446
- """Simple health check endpoint"""
447
- return {"status": "healthy"}
448
-
449
- @app.post("/api/evaluate")
450
- async def submit_evaluation(
451
- request: EvaluationRequest,
452
- background_tasks: BackgroundTasks
453
- ):
454
- """Submit new evaluation task"""
455
- task_id = str(uuid.uuid4())
456
-
457
- task = {
458
- "id": task_id,
459
- "model": request.transcription_model,
460
- "subset": request.subset,
461
- "submission_name": request.submission_name,
462
- "github_url": request.github_url,
463
- "status": "queued",
464
- "submitted_at": datetime.now().isoformat()
465
- }
466
-
467
- tasks = storage_manager.load('tasks')
468
- tasks.append(task)
469
- storage_manager.save('tasks', tasks)
470
-
471
- background_tasks.add_task(evaluate_model, task_id, request)
472
-
473
- return {
474
- "message": "Evaluation task submitted successfully",
475
- "task_id": task_id
476
- }
477
-
478
- @app.get("/api/tasks/{task_id}")
479
- async def get_task(task_id: str):
480
- """Get specific task status"""
481
- tasks = storage_manager.load('tasks')
482
- task = next((t for t in tasks if t["id"] == task_id), None)
483
- if not task:
484
- raise HTTPException(status_code=404, detail="Task not found")
485
- return task
486
-
487
- @app.get("/api/leaderboard")
488
- async def get_leaderboard():
489
- """Get current leaderboard"""
490
- try:
491
- leaderboard = storage_manager.load('leaderboard')
492
- sorted_leaderboard = sorted(leaderboard, key=lambda x: (x["average_pwed"], x["average_per"]))
493
- return sorted_leaderboard
494
- except Exception as e:
495
- print(f"Error loading leaderboard: {e}")
496
- return []
497
-
498
- # Note: We need to mount the FastAPI app after defining all routes
499
- app = gr.mount_gradio_app(app, demo, path="/")
500
-
501
- # For local development
502
- if __name__ == "__main__":
503
- import uvicorn
504
- uvicorn.run(app, host="0.0.0.0", port=7860)
505
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt CHANGED
@@ -1,67 +1,11 @@
1
  # Core ML dependencies
2
  torch==2.0.1
3
- torchaudio
4
- torchvision==0.15.2
5
- transformers==4.46.3
6
- tokenizers>=0.20,<0.21
7
- safetensors>=0.4.1
8
- evaluate==0.4.0
9
- gradio==5.7.1
10
- huggingface-hub==0.25.1
11
  panphon==0.21.2
12
 
13
- # Build tools and compilers (move to top)
14
- Cython==3.0.0
15
- cmake==3.26.4
16
- lit==16.0.6
17
-
18
  # Data processing
19
  pandas==2.0.3
20
  numpy==1.25.2
21
- pyarrow==12.0.1
22
- dill==0.3.6
23
- datasets==2.10.0
24
-
25
- # Utilities
26
- tqdm==4.65.0
27
- requests==2.31.0
28
- regex==2023.6.3
29
- PyYAML==5.3.1
30
- python-dateutil==2.8.2
31
- six==1.16.0
32
- filelock==3.12.2
33
-
34
- # HTTP and async
35
- aiohttp==3.8.4
36
- aiosignal==1.3.1
37
- async-timeout==4.0.2
38
- urllib3==2.0.4
39
- yarl==1.9.2
40
- multidict==6.0.4
41
- frozenlist==1.4.0
42
-
43
- # Text processing
44
- xxhash==3.2.0
45
-
46
- # Image processing
47
- Pillow==10.0.0
48
-
49
- # Math and scientific
50
- matplotlib==3.7.2
51
- sympy==1.12
52
- mpmath==1.3.0
53
- networkx==3.1
54
- contourpy==1.1.0
55
- kiwisolver==1.4.4
56
-
57
-
58
-
59
-
60
- # CUDA dependencies
61
- # nvidia-cudnn-cu11==8.5.0.96
62
- # nvidia-cufft-cu11==10.9.0.58
63
- # nvidia-curand-cu11==10.2.10.91
64
- # nvidia-cusolver-cu11==11.4.0.1
65
- # nvidia-cusparse-cu11==11.7.4.91
66
- # nvidia-nccl-cu11==2.14.3
67
- # nvidia-nvtx-cu11==11.7.91
 
1
  # Core ML dependencies
2
  torch==2.0.1
3
+ torchaudio==2.0.2
4
+ transformers==4.44.2
5
+ huggingface_hub==0.25.1
6
+ gradio==5.12.0
 
 
 
 
7
  panphon==0.21.2
8
 
 
 
 
 
 
9
  # Data processing
10
  pandas==2.0.3
11
  numpy==1.25.2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements_lock.txt ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ certifi==2024.12.14
2
+ cfgv==3.4.0
3
+ charset-normalizer==3.4.1
4
+ distlib==0.3.8
5
+ filelock==3.15.4
6
+ fsspec==2024.12.0
7
+ huggingface-hub==0.27.1
8
+ identify==2.5.36
9
+ idna==3.10
10
+ ml_dtypes==0.5.0
11
+ nodeenv==1.9.1
12
+ numpy==2.1.3
13
+ onnx==1.17.0
14
+ onnxscript==0.1.0.dev20241223
15
+ packaging==24.2
16
+ platformdirs==4.2.2
17
+ pre-commit==3.7.1
18
+ protobuf==5.29.2
19
+ PyYAML==6.0.1
20
+ regex==2024.11.6
21
+ requests==2.32.3
22
+ safetensors==0.5.2
23
+ tokenizers==0.21.0
24
+ tqdm==4.67.1
25
+ transformers==4.48.0
26
+ typing_extensions==4.12.2
27
+ urllib3==2.3.0
28
+ virtualenv==20.26.3
scripts/download_data_curl.sh ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # install ./.data/TIMIT.zip from https://www.kaggle.com/datasets/mfekadu/darpa-timit-acousticphonetic-continuous-speech?resource=download
2
+ curl -L -o ./queue/data/TIMIT.zip\
3
+ https://www.kaggle.com/api/v1/datasets/download/mfekadu/darpa-timit-acousticphonetic-continuous-speech
scripts/download_data_lfs.sh ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # Download the TIMIT.zip dataset
2
+ git lfs pull --include="./queue/data/TIMIT.zip"
install.sh → scripts/install.sh RENAMED
@@ -2,10 +2,18 @@
2
  python3.10 -m venv venv
3
 
4
  # Activate the virtual environment
5
- source venv/bin/activate
6
 
7
  # Install the required dependencies
8
- pip install -r requirements.txt
9
 
10
- # Run the application
11
- uvicorn app:app --host 0.0.0.0 --port 7860
 
 
 
 
 
 
 
 
 
2
  python3.10 -m venv venv
3
 
4
  # Activate the virtual environment
5
+ . ./venv/bin/activate
6
 
7
  # Install the required dependencies
8
+ pip install -r requirements_lock.txt
9
 
10
+ # Download data
11
+ # check if git lfs is installed and run the appropriate script, otherwise run the curl script
12
+ if [ -x "$(command -v git-lfs)" ]; then
13
+ . ./scripts/download_data_lfs.sh
14
+ else
15
+ . ./scripts/download_data_curl.sh
16
+ fi
17
+
18
+ # Deactivate the virtual environment
19
+ deactivate
scripts/run-dev.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Activate the virtual environment
2
+ . ./venv/bin/activate
3
+
4
+ # Run the app with auto-reload enabled
5
+ gradio app/app.py
6
+
7
+ # Deactivate the virtual environment
8
+ deactivate
scripts/run-prod.sh ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Activate the virtual environment
2
+ . ./venv/bin/activate
3
+
4
+ # Run the app without auto-reload
5
+ python app/app.py
6
+
7
+ # Deactivate the virtual environment
8
+ deactivate