Spaces:
Sleeping
Sleeping
Ryan
commited on
Commit
·
fe35cb2
1
Parent(s):
15b45ea
update
Browse files
visualization/roberta_visualizer.py
CHANGED
@@ -64,8 +64,23 @@ def create_sentiment_visualization(analysis_results):
|
|
64 |
for model_name in models:
|
65 |
if model_name in sa_data:
|
66 |
model_result = sa_data[model_name]
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
# Set color based on sentiment
|
71 |
if label.lower() == "positive":
|
|
|
64 |
for model_name in models:
|
65 |
if model_name in sa_data:
|
66 |
model_result = sa_data[model_name]
|
67 |
+
if model_result is not None:
|
68 |
+
score = model_result.get("sentiment_score", 0)
|
69 |
+
label = model_result.get("label", "neutral").capitalize()
|
70 |
+
else:
|
71 |
+
score = 0
|
72 |
+
label = "Neutral"
|
73 |
+
for model_name in models:
|
74 |
+
if model_name in sa_data:
|
75 |
+
model_result = sa_data[model_name]
|
76 |
+
if model_result is not None:
|
77 |
+
# Now safely access model_result
|
78 |
+
score = model_result.get("sentiment_score", 0)
|
79 |
+
label = model_result.get("label", "neutral").capitalize()
|
80 |
+
else:
|
81 |
+
# Provide defaults when model_result is None
|
82 |
+
score = 0
|
83 |
+
label = "Neutral"
|
84 |
|
85 |
# Set color based on sentiment
|
86 |
if label.lower() == "positive":
|