Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -162,7 +162,26 @@ MITIGATION_PROMPTS = {
|
|
| 162 |
"disability": "Focus on accommodations rather than limitations.",
|
| 163 |
"profession": "Avoid hierarchical or role-based stereotypes."
|
| 164 |
}
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
def show_mitigation(bias_type):
|
| 167 |
tip = MITIGATION_PROMPTS.get(
|
| 168 |
bias_type.lower(),
|
|
|
|
| 162 |
"disability": "Focus on accommodations rather than limitations.",
|
| 163 |
"profession": "Avoid hierarchical or role-based stereotypes."
|
| 164 |
}
|
| 165 |
+
gender_keywords = ["women","woman","female","men","man","male","girls","boys"]
|
| 166 |
+
biased_patterns = [
|
| 167 |
+
"should not",
|
| 168 |
+
"can't",
|
| 169 |
+
"better than",
|
| 170 |
+
"inferior",
|
| 171 |
+
"superior",
|
| 172 |
+
"only",
|
| 173 |
+
"not suited"
|
| 174 |
+
]
|
| 175 |
+
|
| 176 |
+
if any(g in text_lower for g in gender_keywords):
|
| 177 |
+
if any(p in text_lower for p in biased_patterns):
|
| 178 |
+
return {
|
| 179 |
+
"biased": True,
|
| 180 |
+
"bias_types": ["gender"],
|
| 181 |
+
"demographic_group": ["women" if "women" in text_lower else "men"]
|
| 182 |
+
}
|
| 183 |
+
return None
|
| 184 |
+
|
| 185 |
def show_mitigation(bias_type):
|
| 186 |
tip = MITIGATION_PROMPTS.get(
|
| 187 |
bias_type.lower(),
|