Sephfox commited on
Commit
c852ed8
·
verified ·
1 Parent(s): 96a1941

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -104,7 +104,7 @@ def update_emotion(emotion, percentage, intensity):
104
  # Normalize percentages
105
  total = sum(e['percentage'] for e in emotions.values())
106
  for e in emotions:
107
- emotions[e]['percentage'] = (emotions[e]['percentage'] / total) * 100
108
 
109
  def normalize_context(context):
110
  return context.lower().strip()
@@ -137,15 +137,15 @@ def evolve_emotions():
137
 
138
  population = toolbox.population(n=100)
139
  algorithms.eaMuPlusLambda(population, toolbox, mu=50, lambda_=100, cxpb=0.7, mutpb=0.2, ngen=50,
140
- stats=None, halloffame=None, verbose=False)
141
 
142
  best_individual = tools.selBest(population, k=1)[0]
143
  emotion_values = best_individual[:len(emotions)]
144
  intensities = best_individual[len(emotions):]
145
 
146
  for i, (emotion, data) in enumerate(emotions.items()):
147
- data['percentage'] = emotion_values[i]
148
- data['intensity'] = intensities[i]
149
 
150
  # Normalize percentages
151
  total = sum(e['percentage'] for e in emotions.values())
@@ -314,4 +314,4 @@ iface = gr.Interface(
314
  description="An AI assistant that can analyze the emotional content of text and generate responses based on its emotional state.",
315
  )
316
 
317
- iface.launch()
 
104
  # Normalize percentages
105
  total = sum(e['percentage'] for e in emotions.values())
106
  for e in emotions:
107
+ emotions[e]['percentage'] = (emotions[e]['percentage'] / total) * 100
108
 
109
  def normalize_context(context):
110
  return context.lower().strip()
 
137
 
138
  population = toolbox.population(n=100)
139
  algorithms.eaMuPlusLambda(population, toolbox, mu=50, lambda_=100, cxpb=0.7, mutpb=0.2, ngen=50,
140
+ stats=None, halloffame=None, verbose=False)
141
 
142
  best_individual = tools.selBest(population, k=1)[0]
143
  emotion_values = best_individual[:len(emotions)]
144
  intensities = best_individual[len(emotions):]
145
 
146
  for i, (emotion, data) in enumerate(emotions.items()):
147
+ data['percentage'] = emotion_values[i]
148
+ data['intensity'] = intensities[i]
149
 
150
  # Normalize percentages
151
  total = sum(e['percentage'] for e in emotions.values())
 
314
  description="An AI assistant that can analyze the emotional content of text and generate responses based on its emotional state.",
315
  )
316
 
317
+ iface.launch()