Hellisotherpeople commited on
Commit
a0d6aa6
1 Parent(s): c6aa028

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -256,7 +256,11 @@ if task == "Classification":
256
  target_feature_names = text_clf['clf'].classes_
257
  #target_feature_names = pd.unique(df[labels_column_name])
258
  target_feature_names_list = list(target_feature_names)
259
- t_pred = te.explain_prediction(target_names = target_feature_names_list, top = top_features, top_targets = top_targets)
 
 
 
 
260
  else:
261
  t_pred = te.explain_prediction(top = top_features, top_targets = top_targets)
262
  html = format_as_html(t_pred)
 
256
  target_feature_names = text_clf['clf'].classes_
257
  #target_feature_names = pd.unique(df[labels_column_name])
258
  target_feature_names_list = list(target_feature_names)
259
+ try:
260
+ t_pred = te.explain_prediction(target_names = target_feature_names_list, top = top_features, top_targets = top_targets)
261
+ except TypeError:
262
+ st.error("Unable to get target label names - most likely due to a numeric label feature type")
263
+ t_pred = te.explain_prediction(top = top_features, top_targets = top_targets)
264
  else:
265
  t_pred = te.explain_prediction(top = top_features, top_targets = top_targets)
266
  html = format_as_html(t_pred)