Spaces:
Runtime error
Runtime error
Update allpreds.py
Browse files- allpreds.py +3 -3
allpreds.py
CHANGED
|
@@ -14,7 +14,7 @@ list_of_biases_and_endpts = {"Gender Bias": {"bias_type": "gender_bias", "endpoi
|
|
| 14 |
|
| 15 |
# this dictionary keeps track of the order of biased confidence score
|
| 16 |
# (if order = 1, it means that at index 1 the value is bias confidence, if order =0 it means that at index 0 the value is bias confidence)
|
| 17 |
-
order_in_confidence = {"gender_bias":
|
| 18 |
|
| 19 |
|
| 20 |
|
|
@@ -41,8 +41,8 @@ def make_preds(content, bias_type):
|
|
| 41 |
# the 'content' and 'prediction' columns. The prediction column contains the bias confidence score.
|
| 42 |
# predict function also returns the bias percentage
|
| 43 |
def predict(content, bias_type, endpoint_id):
|
| 44 |
-
# split the article into
|
| 45 |
-
chunks =
|
| 46 |
possibly_biased = []
|
| 47 |
# define the dataframe with two columns - 'content' and 'predictions'
|
| 48 |
df = pd.DataFrame(columns=['content', 'predictions'])
|
|
|
|
| 14 |
|
| 15 |
# this dictionary keeps track of the order of biased confidence score
|
| 16 |
# (if order = 1, it means that at index 1 the value is bias confidence, if order =0 it means that at index 0 the value is bias confidence)
|
| 17 |
+
order_in_confidence = {"gender_bias": 0, "racial_bias": 1, "political_bias": 0, "hate_speech": 0}
|
| 18 |
|
| 19 |
|
| 20 |
|
|
|
|
| 41 |
# the 'content' and 'prediction' columns. The prediction column contains the bias confidence score.
|
| 42 |
# predict function also returns the bias percentage
|
| 43 |
def predict(content, bias_type, endpoint_id):
|
| 44 |
+
# split the article into sentences
|
| 45 |
+
chunks = split_into_sentences(content)
|
| 46 |
possibly_biased = []
|
| 47 |
# define the dataframe with two columns - 'content' and 'predictions'
|
| 48 |
df = pd.DataFrame(columns=['content', 'predictions'])
|