kunwarsaaim commited on
Commit
3652705
1 Parent(s): 169d0fa

added examples

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -41,7 +41,7 @@ def debias(prompt, model,use_prefix, max_length=50, num_beam=3):
41
  debiasing_prefixes = []
42
  biased_text = wrapper.generate_self_debiasing([prompt], debiasing_prefixes= debiasing_prefixes,min_length=20, max_length=max_length, num_beam=num_beam,no_repeat_ngram_size=2)
43
  biased_text = biased_text[0]
44
- return output_text, biased_text
45
 
46
 
47
  demo = gr.Interface(
@@ -51,7 +51,9 @@ demo = gr.Interface(
51
  gr.Radio(choices=['Prefixes','Keywords'],value='Prefixes',label='Use Debiasing Prefixes or Keywords'),
52
  gr.Number(value=50,label='Max output length'),
53
  gr.Number(value=3,label='Number of beams for beam search')],
54
- outputs = [gr.Textbox(label="Debiased text"),gr.Textbox(label="Biased text")]
 
 
55
  )
56
  if __name__ == '__main__':
57
 
41
  debiasing_prefixes = []
42
  biased_text = wrapper.generate_self_debiasing([prompt], debiasing_prefixes= debiasing_prefixes,min_length=20, max_length=max_length, num_beam=num_beam,no_repeat_ngram_size=2)
43
  biased_text = biased_text[0]
44
+ return output_text, biased_text, "<h4>Examples</h4>\n <ul><li><strong>Prompt: </strong>My professor is a hispanic man <br/> <strong>Debiased Text:</strong> , and he's always had this weird feeling that his parents were not really there, but they were there. And then, of course, there was the whole thing about the kids, which was that they had to be there for the rest of their <br> <strong>Biased Text:</strong> . He's a very good student. I'm not sure if he's really a good person, but he is very intelligent. \"I think he has a lot of respect for the people he works with. It's not like he doesn <li><strong>Prompt: </strong>He is an Arab from the Middle East.<br/> <strong>Debiased Text:</strong> He has been a journalist since 2002, when he was a student at the London School of Economics. He said: \"I've always been interested in the world of politics. I've been involved in politics for many years and I'm very <br> <strong>Biased Text: </strong>He is a member of the Islamic State. \"He has been in Syria for a long time. We have seen him in the past. I think he is very well-known in this country. But he has not been able to get </ul> "
45
 
46
 
47
  demo = gr.Interface(
51
  gr.Radio(choices=['Prefixes','Keywords'],value='Prefixes',label='Use Debiasing Prefixes or Keywords'),
52
  gr.Number(value=50,label='Max output length'),
53
  gr.Number(value=3,label='Number of beams for beam search')],
54
+ outputs = [gr.Textbox(label="Debiased text"),gr.Textbox(label="Biased text"), gr.Markdown(
55
+ value="<h4>Examples</h4>\n <ul><li><strong>Prompt: </strong>My professor is a hispanic man <br/> <strong>Debiased Text:</strong> , and he's always had this weird feeling that his parents were not really there, but they were there. And then, of course, there was the whole thing about the kids, which was that they had to be there for the rest of their <br> <strong>Biased Text:</strong> . He's a very good student. I'm not sure if he's really a good person, but he is very intelligent. \"I think he has a lot of respect for the people he works with. It's not like he doesn <li><strong>Prompt: </strong>He is an Arab from the Middle East.<br/> <strong>Debiased Text:</strong> He has been a journalist since 2002, when he was a student at the London School of Economics. He said: \"I've always been interested in the world of politics. I've been involved in politics for many years and I'm very <br> <strong>Biased Text: </strong>He is a member of the Islamic State. \"He has been in Syria for a long time. We have seen him in the past. I think he is very well-known in this country. But he has not been able to get </ul> ")],
56
+ description = '<a href="https://arxiv.org/abs/2103.00453">Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based Bias in NLP</a>'
57
  )
58
  if __name__ == '__main__':
59