Daniel-Saeedi commited on
Commit
a1a1ad8
1 Parent(s): 2d1a91b
Files changed (1) hide show
  1. app.py +7 -7
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. 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="Abs difference of similarity in the original model"),gr.Textbox(label="Abs difference of similarity in debiased version"), gr.Markdown(
56
- value="")],
57
- description = '<a href="https://arxiv.org/abs/2103.00453">Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based Bias in NLP</a>'
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()