Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,12 +54,12 @@ def analyze_personality_file(file) -> dict:
|
|
| 54 |
# Get full list of scores for each label
|
| 55 |
all_preds = personality_pipe(cv_text)[0] # pipeline returns list per input
|
| 56 |
|
| 57 |
-
# Map to human-friendly trait names and
|
| 58 |
trait_scores = {}
|
| 59 |
for item in all_preds:
|
| 60 |
trait = LABEL_TO_TRAIT.get(item['label'], item['label'])
|
| 61 |
-
#
|
| 62 |
-
trait_scores[trait] = round(item['score']
|
| 63 |
return trait_scores
|
| 64 |
|
| 65 |
with gr.Blocks() as demo:
|
|
@@ -74,6 +74,7 @@ if __name__ == "__main__":
|
|
| 74 |
demo.launch()
|
| 75 |
|
| 76 |
# requirements.txt
|
|
|
|
| 77 |
gradio
|
| 78 |
transformers
|
| 79 |
torch
|
|
|
|
| 54 |
# Get full list of scores for each label
|
| 55 |
all_preds = personality_pipe(cv_text)[0] # pipeline returns list per input
|
| 56 |
|
| 57 |
+
# Map to human-friendly trait names (values between 0 and 1)
|
| 58 |
trait_scores = {}
|
| 59 |
for item in all_preds:
|
| 60 |
trait = LABEL_TO_TRAIT.get(item['label'], item['label'])
|
| 61 |
+
# keep probability in [0,1] for correct Gradio percentage display
|
| 62 |
+
trait_scores[trait] = round(item['score'], 3)
|
| 63 |
return trait_scores
|
| 64 |
|
| 65 |
with gr.Blocks() as demo:
|
|
|
|
| 74 |
demo.launch()
|
| 75 |
|
| 76 |
# requirements.txt
|
| 77 |
+
|
| 78 |
gradio
|
| 79 |
transformers
|
| 80 |
torch
|