Sephfox commited on
Commit
3e002ee
·
verified ·
1 Parent(s): da18a88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -46,9 +46,10 @@ data = {
46
  df = pd.DataFrame(data)
47
 
48
  # Encoding the contexts using One-Hot Encoding (memory-efficient)
49
- encoder = OneHotEncoder(handle_unknown='ignore', sparse=True)
50
- contexts_encoded = encoder.fit_transform(df[['context']])
51
-
 
52
  # Encoding emotions
53
  emotions_target = pd.Categorical(df['emotion']).codes
54
  emotion_classes = pd.Categorical(df['emotion']).categories
 
46
  df = pd.DataFrame(data)
47
 
48
  # Encoding the contexts using One-Hot Encoding (memory-efficient)
49
+ try:
50
+ encoder = OneHotEncoder(handle_unknown='ignore', sparse_output=True)
51
+ except TypeError:
52
+ encoder = OneHotEncoder(handle_unknown='ignore', sparse=True)
53
  # Encoding emotions
54
  emotions_target = pd.Categorical(df['emotion']).codes
55
  emotion_classes = pd.Categorical(df['emotion']).categories