Spaces:
Build error
Build error
The app
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ def debias(gendered_word1,gendered_word2,occupation,model):
|
|
39 |
print(similarity('man', 'nurse', original_wv, original_w2i))
|
40 |
|
41 |
return abs(similarity(gendered_word1, occupation, wv_debiased, w2i_debiased)-similarity(gendered_word2, occupation, wv_debiased, w2i_debiased)), \
|
42 |
-
abs(similarity(gendered_word1, occupation, original_wv, original_w2i)-similarity(gendered_word2, occupation, original_wv, original_w2i)), ""
|
43 |
|
44 |
|
45 |
|
@@ -47,14 +47,14 @@ def debias(gendered_word1,gendered_word2,occupation,model):
|
|
47 |
demo = gr.Interface(
|
48 |
debias,
|
49 |
inputs = [
|
50 |
-
gr.Textbox(placeholder="Gendered Word 1(Exp.
|
51 |
-
gr.Textbox(placeholder="Gendered Word 2(Exp.
|
52 |
-
gr.Textbox(placeholder="Occupation(Exp.
|
53 |
gr.Radio(choices=['Glove-300d'],value='Glove-300d')
|
54 |
],
|
55 |
-
outputs = [gr.Textbox(label="
|
56 |
-
value="")],
|
57 |
-
description = '<a href="https://
|
58 |
)
|
59 |
if __name__ == '__main__':
|
60 |
demo.launch()
|
|
|
39 |
print(similarity('man', 'nurse', original_wv, original_w2i))
|
40 |
|
41 |
return abs(similarity(gendered_word1, occupation, wv_debiased, w2i_debiased)-similarity(gendered_word2, occupation, wv_debiased, w2i_debiased)), \
|
42 |
+
abs(similarity(gendered_word1, occupation, original_wv, original_w2i)-similarity(gendered_word2, occupation, original_wv, original_w2i)), "<h3>How the difference is measured?</h3> <p>abs(similarity(gendered_word1,occupation)-similarity(gendered_word2,occupation))</p>"
|
43 |
|
44 |
|
45 |
|
|
|
47 |
demo = gr.Interface(
|
48 |
debias,
|
49 |
inputs = [
|
50 |
+
gr.Textbox(placeholder="Gendered Word 1(Exp. man)"),
|
51 |
+
gr.Textbox(placeholder="Gendered Word 2(Exp. woman)"),
|
52 |
+
gr.Textbox(placeholder="Occupation(Exp. nurse)"),
|
53 |
gr.Radio(choices=['Glove-300d'],value='Glove-300d')
|
54 |
],
|
55 |
+
outputs = [gr.Textbox(label="Absolute similarity differece in the debiased version"),gr.Textbox(label="Absolute similarity differece in the original version"), gr.Markdown(
|
56 |
+
value="<h3>How the difference is measured?</h3> <p>abs(similarity(gendered_word1,occupation)-similarity(gendered_word2,occupation))</p>")],
|
57 |
+
description = '<a href="https://aclanthology.org/2020.acl-main.484/">Double-Hard Debias: Tailoring Word Embeddings for Gender Bias Mitigation</a>'
|
58 |
)
|
59 |
if __name__ == '__main__':
|
60 |
demo.launch()
|