Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -85,18 +85,21 @@ def launch(text_input):
|
|
85 |
# Decode labels using the label encoder
|
86 |
decoded_labels = label_encoder.inverse_transform(predicted_classes)
|
87 |
|
|
|
|
|
|
|
88 |
print("Most likely ISCO code is {} and probability is {}".format(decoded_labels,highest_probabilities))
|
89 |
|
90 |
# Create descriptive text for the output
|
91 |
#result_text = "Most likely ISCO code is {} and probability is {:.2f}".format(decoded_labels[0], highest_probabilities[0])
|
92 |
-
result_text = f"Predicted ISCO Code: {decoded_labels[0]}\nProbability: {highest_probabilities[0]:.2f}"
|
93 |
return result_text #[decoded_labels[0], highest_probabilities[0]]
|
94 |
|
95 |
|
96 |
iface = gr.Interface(
|
97 |
fn=launch,
|
98 |
inputs=gr.Textbox(lines=2, placeholder="Enter job title in any language (e.g., Software Engineer) and description here (e.g., Develops and maintains software applications)..."),
|
99 |
-
outputs=gr.Textbox(lines=2, placeholder="Predicted ISCO Code: <result> Probability: <result>")
|
100 |
)
|
101 |
|
102 |
iface.launch()
|
|
|
85 |
# Decode labels using the label encoder
|
86 |
decoded_labels = label_encoder.inverse_transform(predicted_classes)
|
87 |
|
88 |
+
map_data = pd.read_excel("ISCO-08 EN Structure and definitions.xlsx")
|
89 |
+
isco_description = map_data[map_data['ISCO 08 Code']==decoded_labels]['Title EN']
|
90 |
+
|
91 |
print("Most likely ISCO code is {} and probability is {}".format(decoded_labels,highest_probabilities))
|
92 |
|
93 |
# Create descriptive text for the output
|
94 |
#result_text = "Most likely ISCO code is {} and probability is {:.2f}".format(decoded_labels[0], highest_probabilities[0])
|
95 |
+
result_text = f"Predicted ISCO Code: {decoded_labels[0]}\nProbability: {highest_probabilities[0]:.2f}\nISCO Description:{isco_description}"
|
96 |
return result_text #[decoded_labels[0], highest_probabilities[0]]
|
97 |
|
98 |
|
99 |
iface = gr.Interface(
|
100 |
fn=launch,
|
101 |
inputs=gr.Textbox(lines=2, placeholder="Enter job title in any language (e.g., Software Engineer) and description here (e.g., Develops and maintains software applications)..."),
|
102 |
+
outputs=gr.Textbox(lines=2, placeholder="Predicted ISCO Code: <result> Probability: <result> ISCO Description: <result>")
|
103 |
)
|
104 |
|
105 |
iface.launch()
|