Fralet commited on
Commit
5b10278
1 Parent(s): bb3c6bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -49,11 +49,15 @@ if resume_text:
49
  highest_score_label = resume_prediction['labels'][0]
50
  st.write("Predicted Personality for the given resume:", highest_score_label)
51
 
52
- # Automatic prediction for each row in DataFrame
53
- for index, row in data.iterrows():
54
- result = classifier(row['processed_text'], labels)
55
- data.at[index, 'Predicted'] = result['labels'][0]
56
- st.dataframe(data[['True_label', 'Predicted']])
 
 
 
 
57
 
58
  # Separate predictions for Female and Male questions
59
  for index, row in data_open.iterrows():
 
49
  highest_score_label = resume_prediction['labels'][0]
50
  st.write("Predicted Personality for the given resume:", highest_score_label)
51
 
52
+ # Automatic prediction for each row in DataFrame using custom labels
53
+ def predict_personality(row):
54
+ custom_labels = [row['MAX1'], row['MAX2'], row['MAX3']]
55
+ processed_text = row['processed_text']
56
+ result = classifier(processed_text, custom_labels)
57
+ return result['labels'][0] # Assumes the labels are sorted by score, highest first
58
+
59
+ data['Predicted'] = data.apply(predict_personality, axis=1)
60
+ st.dataframe(data[['True_label', 'MAX1', 'MAX2', 'MAX3', 'Predicted']])
61
 
62
  # Separate predictions for Female and Male questions
63
  for index, row in data_open.iterrows():