Spaces:
Sleeping
Sleeping
Martijn van Beers
commited on
Commit
•
55d104b
1
Parent(s):
1b9dc66
Use Blocks instead of Interface
Browse filesTo add a collapseable markdown note, build our own interface with
Blocks, so we can add an Accordion element with the markdown in it.
- app.py +17 -8
- description.md +3 -0
- notice.md +3 -0
app.py
CHANGED
@@ -67,13 +67,22 @@ tokenizer = GPT2TokenizerFast.from_pretrained(model_id)
|
|
67 |
dataset = CrowSPairsDataset()
|
68 |
|
69 |
bias_type_sel = gradio.Dropdown(label="Bias Type", choices=dataset.bias_types())
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
iface.launch()
|
|
|
67 |
dataset = CrowSPairsDataset()
|
68 |
|
69 |
bias_type_sel = gradio.Dropdown(label="Bias Type", choices=dataset.bias_types())
|
70 |
+
with open("description.md") as fh:
|
71 |
+
desc = fh.read()
|
72 |
+
|
73 |
+
with open("notice.md") as fh:
|
74 |
+
notice = fh.read()
|
75 |
+
|
76 |
+
with gradio.Blocks() as iface:
|
77 |
+
gradio.Markdown(desc)
|
78 |
+
with gradio.Row(equal_height=True):
|
79 |
+
with gradio.Column(scale=4):
|
80 |
+
inp = gradio.Dropdown(label="Bias Type", choices=dataset.bias_types())
|
81 |
+
with gradio.Column(scale=1):
|
82 |
+
but = gradio.Button("Sample")
|
83 |
+
out = gradio.HTML()
|
84 |
+
but.click(run, inp, out)
|
85 |
+
with gradio.Accordion("A note about explainability models"):
|
86 |
+
gradio.Markdown(notice)
|
87 |
|
88 |
iface.launch()
|
description.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# Detecting stereotypes in the GPT-2 language model using CrowS-Pairs
|
2 |
+
|
3 |
+
GPT-2 is a language model which can score how likely it is that some text is a valid English sentence: not only grammaticality, but also the 'meaning' of the sentence is part of this score. CrowS-Pairs is a dataset with pairs of more and less stereotypical examples for different social groups (e.g., gender and nationality stereotypes). We sample 10 random pairs from CrowS-Pairs and show whether the stereotypical example gets a higher score ('is more likely'). If GPT-2 systematically prefers the stereotypical examples, it has probably learnt these stereotypes from the training data.
|
notice.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# AI still stupid
|
2 |
+
|
3 |
+
don't get fooled; it's all just numbers
|