Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,7 @@ def preprocess_text(text):
|
|
36 |
question_columns = [f'Q{i}' for i in range(1, 37)] # Adjust range if needed
|
37 |
data['combined_text'] = data[['CV/Resume'] + question_columns].agg(' '.join, axis=1)
|
38 |
data['processed_text'] = data['combined_text'].apply(preprocess_text)
|
|
|
39 |
|
40 |
# Prediction confidence threshold
|
41 |
confidence_threshold = st.slider("Confidence Threshold", 0.0, 1.0, 0.5)
|
@@ -45,10 +46,10 @@ if st.button("Predict Personality"):
|
|
45 |
def get_predictions(row):
|
46 |
custom_labels = [row['MAX1'], row['MAX2'], row['MAX3']] # Get labels from each row
|
47 |
processed_text = row['processed_text']
|
48 |
-
result = classifier(processed_text,
|
49 |
highest_score_label = result['labels'][0] # Assumes the labels are sorted by score, highest first
|
50 |
return highest_score_label
|
51 |
|
52 |
# Apply predictions across all rows
|
53 |
data['Predicted'] = data.apply(get_predictions, axis=1)
|
54 |
-
st.dataframe(data[['True_label', 'Predicted']])
|
|
|
36 |
question_columns = [f'Q{i}' for i in range(1, 37)] # Adjust range if needed
|
37 |
data['combined_text'] = data[['CV/Resume'] + question_columns].agg(' '.join, axis=1)
|
38 |
data['processed_text'] = data['combined_text'].apply(preprocess_text)
|
39 |
+
labels = ["Peacemaker", "Loyalist", "Achiever", "Reformer", "Individualist", "Helper", "Challenger", "Investigator", "Enthusiast"]
|
40 |
|
41 |
# Prediction confidence threshold
|
42 |
confidence_threshold = st.slider("Confidence Threshold", 0.0, 1.0, 0.5)
|
|
|
46 |
def get_predictions(row):
|
47 |
custom_labels = [row['MAX1'], row['MAX2'], row['MAX3']] # Get labels from each row
|
48 |
processed_text = row['processed_text']
|
49 |
+
result = classifier(processed_text, labels)
|
50 |
highest_score_label = result['labels'][0] # Assumes the labels are sorted by score, highest first
|
51 |
return highest_score_label
|
52 |
|
53 |
# Apply predictions across all rows
|
54 |
data['Predicted'] = data.apply(get_predictions, axis=1)
|
55 |
+
st.dataframe(data[['True_label','MAX1','MAX2','MAX3', 'Predicted']])
|