pagezyhf HF Staff commited on
Commit
0ff5466
Β·
1 Parent(s): 199cd6b
Files changed (1) hide show
  1. app.py +15 -4
app.py CHANGED
@@ -78,10 +78,21 @@ def get_status_with_text(value, text_value=None):
78
  else:
79
  emoji = "🟒" if value else "πŸ”΄"
80
 
81
- if text_value and not pd.isna(text_value):
82
- return f"{emoji} {text_value}"
83
- else:
84
- return emoji
 
 
 
 
 
 
 
 
 
 
 
85
 
86
  def get_negative_status_with_text(value, text_value=None):
87
  """Convert boolean values to emoji indicators where True is bad (red) and False is good (green), with optional text"""
 
78
  else:
79
  emoji = "🟒" if value else "πŸ”΄"
80
 
81
+ # Handle arrays and None values properly
82
+ if text_value is not None:
83
+ # Convert arrays to scalar if needed
84
+ if hasattr(text_value, '__len__') and hasattr(text_value, 'size'):
85
+ # It's likely a numpy array or similar
86
+ if text_value.size == 0:
87
+ text_value = None
88
+ elif text_value.size == 1:
89
+ text_value = text_value.item() if hasattr(text_value, 'item') else text_value[0]
90
+
91
+ # Now check if we have a valid text value
92
+ if text_value is not None and not pd.isna(text_value) and str(text_value).strip():
93
+ return f"{emoji} {text_value}"
94
+
95
+ return emoji
96
 
97
  def get_negative_status_with_text(value, text_value=None):
98
  """Convert boolean values to emoji indicators where True is bad (red) and False is good (green), with optional text"""