Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -86,20 +86,32 @@ def launch(text_input):
|
|
86 |
decoded_labels = label_encoder.inverse_transform(predicted_classes)
|
87 |
|
88 |
map_data = pd.read_excel("ISCO-08 EN Structure and definitions.xlsx")
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
93 |
# Create descriptive text for the output
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
|
|
|
|
|
|
98 |
|
|
|
99 |
iface = gr.Interface(
|
100 |
fn=launch,
|
101 |
-
inputs=gr.Textbox(
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
)
|
104 |
|
105 |
iface.launch()
|
|
|
86 |
decoded_labels = label_encoder.inverse_transform(predicted_classes)
|
87 |
|
88 |
map_data = pd.read_excel("ISCO-08 EN Structure and definitions.xlsx")
|
89 |
+
# Retrieve the ISCO description based on the decoded label
|
90 |
+
isco_description = map_data[map_data['ISCO 08 Code'] == decoded_labels[0]]['Title EN'].values
|
91 |
+
|
92 |
+
# Print for debugging (optional)
|
93 |
+
print(f"Most likely ISCO code is {decoded_labels[0]} and probability is {highest_probabilities[0]}")
|
94 |
+
|
95 |
# Create descriptive text for the output
|
96 |
+
result_text = (
|
97 |
+
f"Predicted ISCO Code: {decoded_labels[0]}\n"
|
98 |
+
f"Probability: {highest_probabilities[0]:.2f}\n"
|
99 |
+
f"ISCO Description: {isco_description[0] if len(isco_description) > 0 else 'Description not found'}"
|
100 |
+
)
|
101 |
+
|
102 |
+
return result_text
|
103 |
|
104 |
+
# Define the Gradio interface
|
105 |
iface = gr.Interface(
|
106 |
fn=launch,
|
107 |
+
inputs=gr.Textbox(
|
108 |
+
lines=2,
|
109 |
+
placeholder="Enter job title in any language (e.g., Software Engineer) and description here (e.g., Develops and maintains software applications)..."
|
110 |
+
),
|
111 |
+
outputs=gr.Textbox(
|
112 |
+
lines=4,
|
113 |
+
placeholder="Predicted ISCO Code: <result>\nProbability: <result>\nISCO Description: <result>"
|
114 |
+
)
|
115 |
)
|
116 |
|
117 |
iface.launch()
|