clarice7 commited on
Commit
55983d8
1 Parent(s): 64e7a31

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -114,10 +114,12 @@ def simulate(image0, image1):
114
  avg_prob = sum(probs) / len(preferences)
115
 
116
  preference = 0 if avg_preference < 0.5 else 1
117
-
118
- right_reasons = [reasons[i] for i in range(len(reasons)) if preferences[i] == preference]
119
- reasons_list = ast.literal_eval(right_reasons)
120
- all_reasons = ','.join(reasons_list)
 
 
121
  wordcloud = WordCloud(width = 800, height = 400, background_color ='white').generate(all_reasons)
122
 
123
  plt.figure(figsize=(10,5))
 
114
  avg_prob = sum(probs) / len(preferences)
115
 
116
  preference = 0 if avg_preference < 0.5 else 1
117
+
118
+ all_reasons = []
119
+ for item in reasons:
120
+ words = [word.strip() for word in item.split(',')]
121
+ all_reasons.extend(words)
122
+
123
  wordcloud = WordCloud(width = 800, height = 400, background_color ='white').generate(all_reasons)
124
 
125
  plt.figure(figsize=(10,5))