Sephfox commited on
Commit
49ae452
·
verified ·
1 Parent(s): 920da7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -136,7 +136,7 @@ def evolve_emotions():
136
  toolbox.register("attr_float", random.uniform, 0, 20)
137
  toolbox.register("attr_intensity", random.uniform, 0, 10)
138
  toolbox.register("individual", tools.initCycle, creator.Individual,
139
- (toolbox.attr_float,) * (len(emotions) - 1) +
140
  (toolbox.attr_intensity,) * len(emotions) +
141
  (lambda: 100,), n=1)
142
  toolbox.register("population", tools.initRepeat, list, toolbox.individual)
@@ -150,8 +150,8 @@ def evolve_emotions():
150
  stats=None, halloffame=None, verbose=False)
151
 
152
  best_individual = tools.selBest(population, k=1)[0]
153
- emotion_values = best_individual[:len(emotions) - 1]
154
- intensities = best_individual[-len(emotions):]
155
  ideal_state = best_individual[-1]
156
 
157
  for i, emotion in enumerate(emotions):
@@ -160,7 +160,6 @@ def evolve_emotions():
160
  emotions[emotion]['intensity'] = intensities[i]
161
 
162
  emotions['ideal_state']['percentage'] = ideal_state
163
-
164
  def predict_emotion(context):
165
  emotion_prediction_pipeline = pipeline('text-classification', model=emotion_prediction_model, tokenizer=emotion_prediction_tokenizer, top_k=None)
166
  predictions = emotion_prediction_pipeline(context)
 
136
  toolbox.register("attr_float", random.uniform, 0, 20)
137
  toolbox.register("attr_intensity", random.uniform, 0, 10)
138
  toolbox.register("individual", tools.initCycle, creator.Individual,
139
+ (toolbox.attr_float,) * len(emotions) +
140
  (toolbox.attr_intensity,) * len(emotions) +
141
  (lambda: 100,), n=1)
142
  toolbox.register("population", tools.initRepeat, list, toolbox.individual)
 
150
  stats=None, halloffame=None, verbose=False)
151
 
152
  best_individual = tools.selBest(population, k=1)[0]
153
+ emotion_values = best_individual[:len(emotions)]
154
+ intensities = best_individual[len(emotions):-1]
155
  ideal_state = best_individual[-1]
156
 
157
  for i, emotion in enumerate(emotions):
 
160
  emotions[emotion]['intensity'] = intensities[i]
161
 
162
  emotions['ideal_state']['percentage'] = ideal_state
 
163
  def predict_emotion(context):
164
  emotion_prediction_pipeline = pipeline('text-classification', model=emotion_prediction_model, tokenizer=emotion_prediction_tokenizer, top_k=None)
165
  predictions = emotion_prediction_pipeline(context)