Spaces:
Runtime error
Runtime error
Clémentine
commited on
Commit
•
1886745
1
Parent(s):
ca4a86f
10 samples viewer
Browse files- app.py +50 -0
- samples.json +0 -0
app.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import datasets
|
3 |
+
import random
|
4 |
+
import json
|
5 |
+
|
6 |
+
def load_from_ds():
|
7 |
+
name_to_dataset = {
|
8 |
+
"bbh": ("SaylorTwift/bbh", "test", ["sports_understanding", "tracking_shuffled_objects_three_objects", "navigate", "snarks", "date_understanding", "reasoning_about_colored_objects", "object_counting", "logical_deduction_seven_objects", "geometric_shapes", "web_of_lies", "movie_recommendation", "logical_deduction_five_objects", "salient_translation_error_detection", "disambiguation_qa", "temporal_sequences", "hyperbaton", "logical_deduction_three_objects", "causal_judgement", "formal_fallacies", "tracking_shuffled_objects_seven_objects", "ruin_names", "penguins_in_a_table", "boolean_expressions", "tracking_shuffled_objects_five_objects"]),
|
9 |
+
#"GPQA": "Idavidrein/gpqa",
|
10 |
+
"ifeval": ("wis-k/instruction-following-eval", "train", None),
|
11 |
+
"math": ("lighteval/MATH-Hard", "test", None),
|
12 |
+
"mmlu_pro": ("TIGER-Lab/MMLU-Pro", "test", None),
|
13 |
+
"musr": ("TAUR-Lab/MuSR", "murder_mysteries", ["default"]),
|
14 |
+
"musr": ("TAUR-Lab/MuSR", "object_placements", ["default"]),
|
15 |
+
"musr": ("TAUR-Lab/MuSR", "team_allocation", ["default"])
|
16 |
+
}
|
17 |
+
|
18 |
+
examples = {}
|
19 |
+
for name, (path, split, subsets) in name_to_dataset.items():
|
20 |
+
if subsets is None:
|
21 |
+
ds = datasets.load_dataset(path, split=split)
|
22 |
+
examples[name] = {"default": random.sample(list(ds), 10)}
|
23 |
+
else:
|
24 |
+
examples[name] = {}
|
25 |
+
for subset in subsets:
|
26 |
+
ds = datasets.load_dataset(path, subset, split=split)
|
27 |
+
examples[name][subset] = random.sample(list(ds), 10)
|
28 |
+
|
29 |
+
examples = json.load(open("samples.json"))
|
30 |
+
|
31 |
+
with gr.Blocks() as demo:
|
32 |
+
header = gr.Markdown("# Samples explorer")
|
33 |
+
with gr.Row():
|
34 |
+
name = gr.Dropdown(choices=examples.keys(), label="Dataset")
|
35 |
+
subset = gr.Dropdown(choices=[], label="Subset")
|
36 |
+
index = gr.Dropdown(choices=range(10), value=0, label="Choice index")
|
37 |
+
|
38 |
+
with gr.Row():
|
39 |
+
text_box = gr.JSON(value={})
|
40 |
+
|
41 |
+
def change_subset_dropdown(name):
|
42 |
+
keys = sorted(examples[name].keys())
|
43 |
+
return gr.Dropdown(choices=keys, value=keys[0], label="Subset")
|
44 |
+
|
45 |
+
name.change(fn=change_subset_dropdown, inputs=name, outputs=subset)
|
46 |
+
|
47 |
+
for dropdown in [name, subset, index]:
|
48 |
+
dropdown.change(fn= lambda name, subset, index: examples[name][subset][index], inputs=[name, subset, index], outputs=text_box)
|
49 |
+
|
50 |
+
demo.launch()
|
samples.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|