Spaces:
Sleeping
Sleeping
Ryan
commited on
Commit
·
b3c9add
1
Parent(s):
2031ee5
update
Browse files- processors/bias_processor.py +16 -15
processors/bias_processor.py
CHANGED
@@ -121,22 +121,23 @@ The overall bias difference is {bias_results['comparative']['overall']['differen
|
|
121 |
fig3 = make_subplots(rows=1, cols=2, subplot_titles=models)
|
122 |
|
123 |
for i, model in enumerate(models):
|
124 |
-
#
|
125 |
-
#
|
126 |
-
if '
|
127 |
-
frame_counts = bias_results[model]['framing']['
|
|
|
|
|
|
|
|
|
128 |
else:
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
frame_counts[frame] = bias_results[model]['framing'].get(frame, 0)
|
138 |
-
else:
|
139 |
-
frame_counts = frame_data
|
140 |
|
141 |
# Add trace for each model
|
142 |
fig3.add_trace(
|
|
|
121 |
fig3 = make_subplots(rows=1, cols=2, subplot_titles=models)
|
122 |
|
123 |
for i, model in enumerate(models):
|
124 |
+
# Improved handling of framing data
|
125 |
+
# First, try to get the framing_counts directly
|
126 |
+
if 'framing_counts' in bias_results[model]['framing']:
|
127 |
+
frame_counts = bias_results[model]['framing']['framing_counts']
|
128 |
+
# Fall back to frames if framing_counts not available
|
129 |
+
elif 'frames' in bias_results[model]['framing']:
|
130 |
+
frame_counts = bias_results[model]['framing']['frames']
|
131 |
+
# Last resort: create a default structure with zeros
|
132 |
else:
|
133 |
+
frame_counts = {frame: 0 for frame in frames}
|
134 |
+
# Try to populate with any available data
|
135 |
+
for frame in frames:
|
136 |
+
count = bias_results[model]['framing'].get(frame, 0)
|
137 |
+
if count > 0:
|
138 |
+
frame_counts[frame] = count
|
139 |
+
|
140 |
+
logger.info(f"Frame counts for {model}: {frame_counts}")
|
|
|
|
|
|
|
141 |
|
142 |
# Add trace for each model
|
143 |
fig3.add_trace(
|