davidmasip commited on
Commit
2d6ca9b
·
1 Parent(s): 3c60690

better score

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -16,7 +16,12 @@ racism_analysis_pipe = pipeline(
16
  def racism_analysis(text):
17
  results = racism_analysis_pipe(text)[0]
18
  label = "Non-racist" if results["label"] == "LABEL_0" else "Racist"
19
- return label, round(results["score"], 5)
 
 
 
 
 
20
 
21
 
22
  gradio_ui = gr.Interface(
@@ -28,7 +33,7 @@ gradio_ui = gr.Interface(
28
  ],
29
  outputs=[
30
  gr.outputs.Textbox(label="Label"),
31
- gr.outputs.Textbox(label="Score"),
32
  ],
33
  examples=[
34
  ["Unos menas roban a una mujer"],
 
16
  def racism_analysis(text):
17
  results = racism_analysis_pipe(text)[0]
18
  label = "Non-racist" if results["label"] == "LABEL_0" else "Racist"
19
+ score = (
20
+ 1 - round(results["score"], 5)
21
+ if results["label"] == "LABEL_0"
22
+ else round(results["score"], 5)
23
+ )
24
+ return label, score
25
 
26
 
27
  gradio_ui = gr.Interface(
 
33
  ],
34
  outputs=[
35
  gr.outputs.Textbox(label="Label"),
36
+ gr.outputs.Textbox(label="Racism score"),
37
  ],
38
  examples=[
39
  ["Unos menas roban a una mujer"],