Spaces:
Running
Running
Add files
Browse files- .gitignore +162 -0
- .pre-commit-config.yaml +60 -0
- .python-version +1 -0
- .vscode/settings.json +30 -0
- LICENSE +21 -0
- README.md +5 -5
- app.py +169 -0
- pyproject.toml +11 -0
- requirements.txt +221 -0
- style.css +11 -0
- uv.lock +0 -0
.gitignore
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
gradio_cached_examples/
|
2 |
+
|
3 |
+
# Byte-compiled / optimized / DLL files
|
4 |
+
__pycache__/
|
5 |
+
*.py[cod]
|
6 |
+
*$py.class
|
7 |
+
|
8 |
+
# C extensions
|
9 |
+
*.so
|
10 |
+
|
11 |
+
# Distribution / packaging
|
12 |
+
.Python
|
13 |
+
build/
|
14 |
+
develop-eggs/
|
15 |
+
dist/
|
16 |
+
downloads/
|
17 |
+
eggs/
|
18 |
+
.eggs/
|
19 |
+
lib/
|
20 |
+
lib64/
|
21 |
+
parts/
|
22 |
+
sdist/
|
23 |
+
var/
|
24 |
+
wheels/
|
25 |
+
share/python-wheels/
|
26 |
+
*.egg-info/
|
27 |
+
.installed.cfg
|
28 |
+
*.egg
|
29 |
+
MANIFEST
|
30 |
+
|
31 |
+
# PyInstaller
|
32 |
+
# Usually these files are written by a python script from a template
|
33 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
34 |
+
*.manifest
|
35 |
+
*.spec
|
36 |
+
|
37 |
+
# Installer logs
|
38 |
+
pip-log.txt
|
39 |
+
pip-delete-this-directory.txt
|
40 |
+
|
41 |
+
# Unit test / coverage reports
|
42 |
+
htmlcov/
|
43 |
+
.tox/
|
44 |
+
.nox/
|
45 |
+
.coverage
|
46 |
+
.coverage.*
|
47 |
+
.cache
|
48 |
+
nosetests.xml
|
49 |
+
coverage.xml
|
50 |
+
*.cover
|
51 |
+
*.py,cover
|
52 |
+
.hypothesis/
|
53 |
+
.pytest_cache/
|
54 |
+
cover/
|
55 |
+
|
56 |
+
# Translations
|
57 |
+
*.mo
|
58 |
+
*.pot
|
59 |
+
|
60 |
+
# Django stuff:
|
61 |
+
*.log
|
62 |
+
local_settings.py
|
63 |
+
db.sqlite3
|
64 |
+
db.sqlite3-journal
|
65 |
+
|
66 |
+
# Flask stuff:
|
67 |
+
instance/
|
68 |
+
.webassets-cache
|
69 |
+
|
70 |
+
# Scrapy stuff:
|
71 |
+
.scrapy
|
72 |
+
|
73 |
+
# Sphinx documentation
|
74 |
+
docs/_build/
|
75 |
+
|
76 |
+
# PyBuilder
|
77 |
+
.pybuilder/
|
78 |
+
target/
|
79 |
+
|
80 |
+
# Jupyter Notebook
|
81 |
+
.ipynb_checkpoints
|
82 |
+
|
83 |
+
# IPython
|
84 |
+
profile_default/
|
85 |
+
ipython_config.py
|
86 |
+
|
87 |
+
# pyenv
|
88 |
+
# For a library or package, you might want to ignore these files since the code is
|
89 |
+
# intended to run in multiple environments; otherwise, check them in:
|
90 |
+
# .python-version
|
91 |
+
|
92 |
+
# pipenv
|
93 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
94 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
95 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
96 |
+
# install all needed dependencies.
|
97 |
+
#Pipfile.lock
|
98 |
+
|
99 |
+
# poetry
|
100 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
101 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
102 |
+
# commonly ignored for libraries.
|
103 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
104 |
+
#poetry.lock
|
105 |
+
|
106 |
+
# pdm
|
107 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
108 |
+
#pdm.lock
|
109 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
110 |
+
# in version control.
|
111 |
+
# https://pdm.fming.dev/#use-with-ide
|
112 |
+
.pdm.toml
|
113 |
+
|
114 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
115 |
+
__pypackages__/
|
116 |
+
|
117 |
+
# Celery stuff
|
118 |
+
celerybeat-schedule
|
119 |
+
celerybeat.pid
|
120 |
+
|
121 |
+
# SageMath parsed files
|
122 |
+
*.sage.py
|
123 |
+
|
124 |
+
# Environments
|
125 |
+
.env
|
126 |
+
.venv
|
127 |
+
env/
|
128 |
+
venv/
|
129 |
+
ENV/
|
130 |
+
env.bak/
|
131 |
+
venv.bak/
|
132 |
+
|
133 |
+
# Spyder project settings
|
134 |
+
.spyderproject
|
135 |
+
.spyproject
|
136 |
+
|
137 |
+
# Rope project settings
|
138 |
+
.ropeproject
|
139 |
+
|
140 |
+
# mkdocs documentation
|
141 |
+
/site
|
142 |
+
|
143 |
+
# mypy
|
144 |
+
.mypy_cache/
|
145 |
+
.dmypy.json
|
146 |
+
dmypy.json
|
147 |
+
|
148 |
+
# Pyre type checker
|
149 |
+
.pyre/
|
150 |
+
|
151 |
+
# pytype static type analyzer
|
152 |
+
.pytype/
|
153 |
+
|
154 |
+
# Cython debug symbols
|
155 |
+
cython_debug/
|
156 |
+
|
157 |
+
# PyCharm
|
158 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
159 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
160 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
161 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
162 |
+
#.idea/
|
.pre-commit-config.yaml
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
repos:
|
2 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
3 |
+
rev: v4.6.0
|
4 |
+
hooks:
|
5 |
+
- id: check-executables-have-shebangs
|
6 |
+
- id: check-json
|
7 |
+
- id: check-merge-conflict
|
8 |
+
- id: check-shebang-scripts-are-executable
|
9 |
+
- id: check-toml
|
10 |
+
- id: check-yaml
|
11 |
+
- id: end-of-file-fixer
|
12 |
+
- id: mixed-line-ending
|
13 |
+
args: ["--fix=lf"]
|
14 |
+
- id: requirements-txt-fixer
|
15 |
+
- id: trailing-whitespace
|
16 |
+
- repo: https://github.com/myint/docformatter
|
17 |
+
rev: v1.7.5
|
18 |
+
hooks:
|
19 |
+
- id: docformatter
|
20 |
+
args: ["--in-place"]
|
21 |
+
- repo: https://github.com/pycqa/isort
|
22 |
+
rev: 5.13.2
|
23 |
+
hooks:
|
24 |
+
- id: isort
|
25 |
+
args: ["--profile", "black"]
|
26 |
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
27 |
+
rev: v1.11.2
|
28 |
+
hooks:
|
29 |
+
- id: mypy
|
30 |
+
args: ["--ignore-missing-imports"]
|
31 |
+
additional_dependencies:
|
32 |
+
[
|
33 |
+
"types-python-slugify",
|
34 |
+
"types-requests",
|
35 |
+
"types-PyYAML",
|
36 |
+
"types-pytz",
|
37 |
+
]
|
38 |
+
- repo: https://github.com/psf/black
|
39 |
+
rev: 24.8.0
|
40 |
+
hooks:
|
41 |
+
- id: black
|
42 |
+
language_version: python3.10
|
43 |
+
args: ["--line-length", "119"]
|
44 |
+
- repo: https://github.com/kynan/nbstripout
|
45 |
+
rev: 0.7.1
|
46 |
+
hooks:
|
47 |
+
- id: nbstripout
|
48 |
+
args:
|
49 |
+
[
|
50 |
+
"--extra-keys",
|
51 |
+
"metadata.interpreter metadata.kernelspec cell.metadata.pycharm",
|
52 |
+
]
|
53 |
+
- repo: https://github.com/nbQA-dev/nbQA
|
54 |
+
rev: 1.8.7
|
55 |
+
hooks:
|
56 |
+
- id: nbqa-black
|
57 |
+
- id: nbqa-pyupgrade
|
58 |
+
args: ["--py37-plus"]
|
59 |
+
- id: nbqa-isort
|
60 |
+
args: ["--float-to-top"]
|
.python-version
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
3.10
|
.vscode/settings.json
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"editor.formatOnSave": true,
|
3 |
+
"files.insertFinalNewline": false,
|
4 |
+
"[python]": {
|
5 |
+
"editor.defaultFormatter": "ms-python.black-formatter",
|
6 |
+
"editor.formatOnType": true,
|
7 |
+
"editor.codeActionsOnSave": {
|
8 |
+
"source.organizeImports": "explicit"
|
9 |
+
}
|
10 |
+
},
|
11 |
+
"[jupyter]": {
|
12 |
+
"files.insertFinalNewline": false
|
13 |
+
},
|
14 |
+
"black-formatter.args": [
|
15 |
+
"--line-length=119"
|
16 |
+
],
|
17 |
+
"isort.args": ["--profile", "black"],
|
18 |
+
"flake8.args": [
|
19 |
+
"--max-line-length=119"
|
20 |
+
],
|
21 |
+
"ruff.lint.args": [
|
22 |
+
"--line-length=119"
|
23 |
+
],
|
24 |
+
"notebook.output.scrolling": true,
|
25 |
+
"notebook.formatOnCellExecution": true,
|
26 |
+
"notebook.formatOnSave.enabled": true,
|
27 |
+
"notebook.codeActionsOnSave": {
|
28 |
+
"source.organizeImports": "explicit"
|
29 |
+
}
|
30 |
+
}
|
LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
MIT License
|
2 |
+
|
3 |
+
Copyright (c) 2023 hysts
|
4 |
+
|
5 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
+
of this software and associated documentation files (the "Software"), to deal
|
7 |
+
in the Software without restriction, including without limitation the rights
|
8 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
+
copies of the Software, and to permit persons to whom the Software is
|
10 |
+
furnished to do so, subject to the following conditions:
|
11 |
+
|
12 |
+
The above copyright notice and this permission notice shall be included in all
|
13 |
+
copies or substantial portions of the Software.
|
14 |
+
|
15 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21 |
+
SOFTWARE.
|
README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
---
|
2 |
-
title: MMMU
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.44.1
|
8 |
app_file: app.py
|
9 |
-
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: MMMU dataset viewer
|
3 |
+
emoji: ⚡
|
4 |
+
colorFrom: red
|
5 |
+
colorTo: purple
|
6 |
sdk: gradio
|
7 |
sdk_version: 4.44.1
|
8 |
app_file: app.py
|
9 |
+
license: mit
|
10 |
---
|
11 |
|
12 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
|
3 |
+
import ast
|
4 |
+
import os
|
5 |
+
|
6 |
+
import datasets
|
7 |
+
import gradio as gr
|
8 |
+
import PIL.Image
|
9 |
+
|
10 |
+
DESCRIPTION = """\
|
11 |
+
# [MMMU](https://huggingface.co/datasets/MMMU/MMMU) dataset viewer
|
12 |
+
"""
|
13 |
+
|
14 |
+
SHOW_ANSWER = os.getenv("SHOW_ANSWER", "false").lower() == "true"
|
15 |
+
SHOW_QUESTION_DETAILS = os.getenv("SHOW_QUESTION_DETAILS", "false").lower() == "true"
|
16 |
+
|
17 |
+
SUBJECTS = [
|
18 |
+
"Accounting",
|
19 |
+
"Agriculture",
|
20 |
+
"Architecture_and_Engineering",
|
21 |
+
"Art",
|
22 |
+
"Art_Theory",
|
23 |
+
"Basic_Medical_Science",
|
24 |
+
"Biology",
|
25 |
+
"Chemistry",
|
26 |
+
"Clinical_Medicine",
|
27 |
+
"Computer_Science",
|
28 |
+
"Design",
|
29 |
+
"Diagnostics_and_Laboratory_Medicine",
|
30 |
+
"Economics",
|
31 |
+
"Electronics",
|
32 |
+
"Energy_and_Power",
|
33 |
+
"Finance",
|
34 |
+
"Geography",
|
35 |
+
"History",
|
36 |
+
"Literature",
|
37 |
+
"Manage",
|
38 |
+
"Marketing",
|
39 |
+
"Materials",
|
40 |
+
"Math",
|
41 |
+
"Mechanical_Engineering",
|
42 |
+
"Music",
|
43 |
+
"Pharmacy",
|
44 |
+
"Physics",
|
45 |
+
"Psychology",
|
46 |
+
"Public_Health",
|
47 |
+
"Sociology",
|
48 |
+
]
|
49 |
+
ds = {subject: datasets.load_dataset("MMMU/MMMU", name=subject, split="validation") for subject in SUBJECTS}
|
50 |
+
|
51 |
+
|
52 |
+
def set_default_subject() -> str:
|
53 |
+
return "Accounting"
|
54 |
+
|
55 |
+
|
56 |
+
def get_images(subject: str, question_index: int) -> list[PIL.Image.Image]:
|
57 |
+
images = []
|
58 |
+
for image_id in range(1, 8):
|
59 |
+
image = ds[subject][question_index][f"image_{image_id}"]
|
60 |
+
if image is None:
|
61 |
+
break
|
62 |
+
images.append(image)
|
63 |
+
return images
|
64 |
+
|
65 |
+
|
66 |
+
def update_subject(
|
67 |
+
subject: str,
|
68 |
+
) -> tuple[
|
69 |
+
gr.Textbox, # Number of Questions
|
70 |
+
gr.Slider, # Question Index
|
71 |
+
gr.Gallery, # Images
|
72 |
+
gr.Textbox, # Question
|
73 |
+
gr.Textbox, # Options
|
74 |
+
gr.Textbox, # Answer
|
75 |
+
gr.Textbox, # Explanation
|
76 |
+
gr.Textbox, # Topic Difficulty
|
77 |
+
gr.Textbox, # Question Type
|
78 |
+
gr.Textbox, # Subfield
|
79 |
+
]:
|
80 |
+
return (
|
81 |
+
gr.Textbox(value=len(ds[subject])), # Number of Questions
|
82 |
+
gr.Slider(label="Question Index", minimum=0, maximum=len(ds[subject]) - 1, step=1, value=0), # Question Index
|
83 |
+
) + update_question(subject, 0)
|
84 |
+
|
85 |
+
|
86 |
+
def update_question(subject: str, question_index: int) -> tuple[
|
87 |
+
gr.Gallery, # Images
|
88 |
+
gr.Textbox, # Question
|
89 |
+
gr.Textbox, # Options
|
90 |
+
gr.Textbox, # Answer
|
91 |
+
gr.Textbox, # Explanation
|
92 |
+
gr.Textbox, # Topic Difficulty
|
93 |
+
gr.Textbox, # Question Type
|
94 |
+
gr.Textbox, # Subfield
|
95 |
+
]:
|
96 |
+
question = ds[subject][question_index]
|
97 |
+
|
98 |
+
options = ast.literal_eval(question["options"])
|
99 |
+
options_str = "\n".join([f"{chr(65 + i)}. {option}" for i, option in enumerate(options)])
|
100 |
+
images = get_images(subject, question_index)
|
101 |
+
return (
|
102 |
+
gr.Gallery(value=images, columns=min(len(images), 2)), # Images
|
103 |
+
gr.Textbox(value=question["question"]), # Question
|
104 |
+
gr.Textbox(value=options_str), # Options
|
105 |
+
gr.Textbox(value=question["answer"]), # Answer
|
106 |
+
gr.Textbox(value=question["explanation"]), # Explanation
|
107 |
+
gr.Textbox(value=question["topic_difficulty"]), # Topic Difficulty
|
108 |
+
gr.Textbox(value=question["question_type"]), # Question Type
|
109 |
+
gr.Textbox(value=question["subfield"]), # Subfield
|
110 |
+
)
|
111 |
+
|
112 |
+
|
113 |
+
with gr.Blocks(css="style.css") as demo:
|
114 |
+
gr.Markdown(DESCRIPTION)
|
115 |
+
with gr.Row():
|
116 |
+
subject = gr.Dropdown(label="Subject", choices=SUBJECTS)
|
117 |
+
question_count = gr.Textbox(label="Number of Questions")
|
118 |
+
|
119 |
+
with gr.Group():
|
120 |
+
question_index = gr.Slider(label="Question Index")
|
121 |
+
with gr.Row():
|
122 |
+
with gr.Column():
|
123 |
+
question = gr.Textbox(label="Question")
|
124 |
+
options = gr.Textbox(label="Options")
|
125 |
+
with gr.Column():
|
126 |
+
images = gr.Gallery(label="Images", object_fit="scale-down")
|
127 |
+
|
128 |
+
with gr.Accordion("Answer and Explanation", open=SHOW_ANSWER):
|
129 |
+
with gr.Row():
|
130 |
+
answer = gr.Textbox(label="Answer")
|
131 |
+
explanation = gr.Textbox(label="Explanation")
|
132 |
+
|
133 |
+
with gr.Accordion("Question Details", open=SHOW_QUESTION_DETAILS):
|
134 |
+
with gr.Row():
|
135 |
+
topic_difficulty = gr.Textbox(label="Topic Difficulty")
|
136 |
+
question_type = gr.Textbox(label="Question Type")
|
137 |
+
subfield = gr.Textbox(label="Subfield")
|
138 |
+
|
139 |
+
subject.change(
|
140 |
+
fn=update_subject,
|
141 |
+
inputs=subject,
|
142 |
+
outputs=[
|
143 |
+
question_count,
|
144 |
+
question_index,
|
145 |
+
images,
|
146 |
+
question,
|
147 |
+
options,
|
148 |
+
answer,
|
149 |
+
explanation,
|
150 |
+
topic_difficulty,
|
151 |
+
question_type,
|
152 |
+
subfield,
|
153 |
+
],
|
154 |
+
queue=False,
|
155 |
+
api_name=False,
|
156 |
+
)
|
157 |
+
|
158 |
+
question_index.input(
|
159 |
+
fn=update_question,
|
160 |
+
inputs=[subject, question_index],
|
161 |
+
outputs=[images, question, options, answer, explanation, topic_difficulty, question_type, subfield],
|
162 |
+
queue=False,
|
163 |
+
api_name=False,
|
164 |
+
)
|
165 |
+
|
166 |
+
demo.load(fn=set_default_subject, outputs=subject, queue=False, api_name=False)
|
167 |
+
|
168 |
+
if __name__ == "__main__":
|
169 |
+
demo.queue(api_open=False).launch(show_api=False)
|
pyproject.toml
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[project]
|
2 |
+
name = "mmmu-dataset-viewer"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = "Add your description here"
|
5 |
+
readme = "README.md"
|
6 |
+
requires-python = ">=3.10"
|
7 |
+
dependencies = [
|
8 |
+
"datasets>=3.0.1",
|
9 |
+
"gradio>=4.44.1",
|
10 |
+
"hf-transfer>=0.1.8",
|
11 |
+
]
|
requirements.txt
ADDED
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# This file was autogenerated by uv via the following command:
|
2 |
+
# uv pip compile pyproject.toml -o requirements.txt
|
3 |
+
aiofiles==23.2.1
|
4 |
+
# via gradio
|
5 |
+
aiohappyeyeballs==2.4.3
|
6 |
+
# via aiohttp
|
7 |
+
aiohttp==3.10.8
|
8 |
+
# via
|
9 |
+
# datasets
|
10 |
+
# fsspec
|
11 |
+
aiosignal==1.3.1
|
12 |
+
# via aiohttp
|
13 |
+
annotated-types==0.7.0
|
14 |
+
# via pydantic
|
15 |
+
anyio==4.6.0
|
16 |
+
# via
|
17 |
+
# gradio
|
18 |
+
# httpx
|
19 |
+
# starlette
|
20 |
+
async-timeout==4.0.3
|
21 |
+
# via aiohttp
|
22 |
+
attrs==24.2.0
|
23 |
+
# via aiohttp
|
24 |
+
certifi==2024.8.30
|
25 |
+
# via
|
26 |
+
# httpcore
|
27 |
+
# httpx
|
28 |
+
# requests
|
29 |
+
charset-normalizer==3.3.2
|
30 |
+
# via requests
|
31 |
+
click==8.1.7
|
32 |
+
# via
|
33 |
+
# typer
|
34 |
+
# uvicorn
|
35 |
+
contourpy==1.3.0
|
36 |
+
# via matplotlib
|
37 |
+
cycler==0.12.1
|
38 |
+
# via matplotlib
|
39 |
+
datasets==3.0.1
|
40 |
+
# via mmmu-dataset-viewer (pyproject.toml)
|
41 |
+
dill==0.3.8
|
42 |
+
# via
|
43 |
+
# datasets
|
44 |
+
# multiprocess
|
45 |
+
exceptiongroup==1.2.2
|
46 |
+
# via anyio
|
47 |
+
fastapi==0.115.0
|
48 |
+
# via gradio
|
49 |
+
ffmpy==0.4.0
|
50 |
+
# via gradio
|
51 |
+
filelock==3.16.1
|
52 |
+
# via
|
53 |
+
# datasets
|
54 |
+
# huggingface-hub
|
55 |
+
fonttools==4.54.1
|
56 |
+
# via matplotlib
|
57 |
+
frozenlist==1.4.1
|
58 |
+
# via
|
59 |
+
# aiohttp
|
60 |
+
# aiosignal
|
61 |
+
fsspec==2024.6.1
|
62 |
+
# via
|
63 |
+
# datasets
|
64 |
+
# gradio-client
|
65 |
+
# huggingface-hub
|
66 |
+
gradio==4.44.1
|
67 |
+
# via mmmu-dataset-viewer (pyproject.toml)
|
68 |
+
gradio-client==1.3.0
|
69 |
+
# via gradio
|
70 |
+
h11==0.14.0
|
71 |
+
# via
|
72 |
+
# httpcore
|
73 |
+
# uvicorn
|
74 |
+
hf-transfer==0.1.8
|
75 |
+
# via mmmu-dataset-viewer (pyproject.toml)
|
76 |
+
httpcore==1.0.6
|
77 |
+
# via httpx
|
78 |
+
httpx==0.27.2
|
79 |
+
# via
|
80 |
+
# gradio
|
81 |
+
# gradio-client
|
82 |
+
huggingface-hub==0.25.1
|
83 |
+
# via
|
84 |
+
# datasets
|
85 |
+
# gradio
|
86 |
+
# gradio-client
|
87 |
+
idna==3.10
|
88 |
+
# via
|
89 |
+
# anyio
|
90 |
+
# httpx
|
91 |
+
# requests
|
92 |
+
# yarl
|
93 |
+
importlib-resources==6.4.5
|
94 |
+
# via gradio
|
95 |
+
jinja2==3.1.4
|
96 |
+
# via gradio
|
97 |
+
kiwisolver==1.4.7
|
98 |
+
# via matplotlib
|
99 |
+
markdown-it-py==3.0.0
|
100 |
+
# via rich
|
101 |
+
markupsafe==2.1.5
|
102 |
+
# via
|
103 |
+
# gradio
|
104 |
+
# jinja2
|
105 |
+
matplotlib==3.9.2
|
106 |
+
# via gradio
|
107 |
+
mdurl==0.1.2
|
108 |
+
# via markdown-it-py
|
109 |
+
multidict==6.1.0
|
110 |
+
# via
|
111 |
+
# aiohttp
|
112 |
+
# yarl
|
113 |
+
multiprocess==0.70.16
|
114 |
+
# via datasets
|
115 |
+
numpy==2.1.1
|
116 |
+
# via
|
117 |
+
# contourpy
|
118 |
+
# datasets
|
119 |
+
# gradio
|
120 |
+
# matplotlib
|
121 |
+
# pandas
|
122 |
+
# pyarrow
|
123 |
+
orjson==3.10.7
|
124 |
+
# via gradio
|
125 |
+
packaging==24.1
|
126 |
+
# via
|
127 |
+
# datasets
|
128 |
+
# gradio
|
129 |
+
# gradio-client
|
130 |
+
# huggingface-hub
|
131 |
+
# matplotlib
|
132 |
+
pandas==2.2.3
|
133 |
+
# via
|
134 |
+
# datasets
|
135 |
+
# gradio
|
136 |
+
pillow==10.4.0
|
137 |
+
# via
|
138 |
+
# gradio
|
139 |
+
# matplotlib
|
140 |
+
pyarrow==17.0.0
|
141 |
+
# via datasets
|
142 |
+
pydantic==2.9.2
|
143 |
+
# via
|
144 |
+
# fastapi
|
145 |
+
# gradio
|
146 |
+
pydantic-core==2.23.4
|
147 |
+
# via pydantic
|
148 |
+
pydub==0.25.1
|
149 |
+
# via gradio
|
150 |
+
pygments==2.18.0
|
151 |
+
# via rich
|
152 |
+
pyparsing==3.1.4
|
153 |
+
# via matplotlib
|
154 |
+
python-dateutil==2.9.0.post0
|
155 |
+
# via
|
156 |
+
# matplotlib
|
157 |
+
# pandas
|
158 |
+
python-multipart==0.0.12
|
159 |
+
# via gradio
|
160 |
+
pytz==2024.2
|
161 |
+
# via pandas
|
162 |
+
pyyaml==6.0.2
|
163 |
+
# via
|
164 |
+
# datasets
|
165 |
+
# gradio
|
166 |
+
# huggingface-hub
|
167 |
+
requests==2.32.3
|
168 |
+
# via
|
169 |
+
# datasets
|
170 |
+
# huggingface-hub
|
171 |
+
rich==13.9.1
|
172 |
+
# via typer
|
173 |
+
ruff==0.6.8
|
174 |
+
# via gradio
|
175 |
+
semantic-version==2.10.0
|
176 |
+
# via gradio
|
177 |
+
shellingham==1.5.4
|
178 |
+
# via typer
|
179 |
+
six==1.16.0
|
180 |
+
# via python-dateutil
|
181 |
+
sniffio==1.3.1
|
182 |
+
# via
|
183 |
+
# anyio
|
184 |
+
# httpx
|
185 |
+
starlette==0.38.6
|
186 |
+
# via fastapi
|
187 |
+
tomlkit==0.12.0
|
188 |
+
# via gradio
|
189 |
+
tqdm==4.66.5
|
190 |
+
# via
|
191 |
+
# datasets
|
192 |
+
# huggingface-hub
|
193 |
+
typer==0.12.5
|
194 |
+
# via gradio
|
195 |
+
typing-extensions==4.12.2
|
196 |
+
# via
|
197 |
+
# anyio
|
198 |
+
# fastapi
|
199 |
+
# gradio
|
200 |
+
# gradio-client
|
201 |
+
# huggingface-hub
|
202 |
+
# multidict
|
203 |
+
# pydantic
|
204 |
+
# pydantic-core
|
205 |
+
# rich
|
206 |
+
# typer
|
207 |
+
# uvicorn
|
208 |
+
tzdata==2024.2
|
209 |
+
# via pandas
|
210 |
+
urllib3==2.2.3
|
211 |
+
# via
|
212 |
+
# gradio
|
213 |
+
# requests
|
214 |
+
uvicorn==0.31.0
|
215 |
+
# via gradio
|
216 |
+
websockets==12.0
|
217 |
+
# via gradio-client
|
218 |
+
xxhash==3.5.0
|
219 |
+
# via datasets
|
220 |
+
yarl==1.13.1
|
221 |
+
# via aiohttp
|
style.css
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
h1 {
|
2 |
+
text-align: center;
|
3 |
+
display: block;
|
4 |
+
}
|
5 |
+
|
6 |
+
#duplicate-button {
|
7 |
+
margin: auto;
|
8 |
+
color: #fff;
|
9 |
+
background: #1565c0;
|
10 |
+
border-radius: 100vh;
|
11 |
+
}
|
uv.lock
ADDED
The diff for this file is too large to render.
See raw diff
|
|