Spaces:
Running
Running
Update app.py
Browse files
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,) *
|
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)
|
154 |
-
intensities = best_individual[
|
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)
|