Spaces:
Sleeping
Sleeping
Martijn van Beers
commited on
Commit
·
1b9dc66
1
Parent(s):
e9d81ac
rescale intensity
Browse filesmake sure the colour intensity doesn't get too close to zero to notice
it.
app.py
CHANGED
@@ -46,9 +46,11 @@ def run(bias_type):
|
|
46 |
shade = round(
|
47 |
abs((perplexity_more - perplexity_less) / perplexity_more), 2
|
48 |
)
|
|
|
49 |
result += f"<td style='padding: 0 1em;)'>{row['sent_more']}</td><td style='padding: 0 1em; background-color: rgba(255,0,255,{shade})'>{row['sent_less']}</td></tr>"
|
50 |
else:
|
51 |
shade = abs((perplexity_less - perplexity_more) / perplexity_less)
|
|
|
52 |
result += f"<td style='padding: 0 1em; background-color: rgba(0,255,255,{shade})'>{row['sent_more']}</td><td style='padding: 0 1em;'>{row['sent_less']}</td></tr>"
|
53 |
result += "</table>"
|
54 |
return result
|
|
|
46 |
shade = round(
|
47 |
abs((perplexity_more - perplexity_less) / perplexity_more), 2
|
48 |
)
|
49 |
+
shade = (shade + 0.2) / 1.2
|
50 |
result += f"<td style='padding: 0 1em;)'>{row['sent_more']}</td><td style='padding: 0 1em; background-color: rgba(255,0,255,{shade})'>{row['sent_less']}</td></tr>"
|
51 |
else:
|
52 |
shade = abs((perplexity_less - perplexity_more) / perplexity_less)
|
53 |
+
shade = (shade + 0.2) / 1.2
|
54 |
result += f"<td style='padding: 0 1em; background-color: rgba(0,255,255,{shade})'>{row['sent_more']}</td><td style='padding: 0 1em;'>{row['sent_less']}</td></tr>"
|
55 |
result += "</table>"
|
56 |
return result
|