Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -42,7 +42,13 @@ def retrieve_and_rerank_faiss(job_duties, model_name="BAAI/bge-m3", top_k=4):
|
|
42 |
query_embedding = np.array(query_embedding).astype("float32")
|
43 |
distances, indices = index.search(query_embedding, top_k)
|
44 |
results = [
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
for i, idx in enumerate(indices[0])
|
47 |
]
|
48 |
return results
|
@@ -50,7 +56,7 @@ def retrieve_and_rerank_faiss(job_duties, model_name="BAAI/bge-m3", top_k=4):
|
|
50 |
# Gradio Interface
|
51 |
def gradio_interface(job_duties):
|
52 |
results = retrieve_and_rerank_faiss(job_duties)
|
53 |
-
return
|
54 |
|
55 |
-
iface = gr.Interface(fn=gradio_interface, inputs="text", outputs="
|
56 |
iface.launch()
|
|
|
42 |
query_embedding = np.array(query_embedding).astype("float32")
|
43 |
distances, indices = index.search(query_embedding, top_k)
|
44 |
results = [
|
45 |
+
{
|
46 |
+
"ISCO_CODE_4": isco_taxonomy[str(idx)]["ISCO_CODE_4"],
|
47 |
+
"ISCO_LABEL_4": isco_taxonomy[str(idx)]["ISCO_LABEL_4"],
|
48 |
+
"ESCO_OCCUPATION": isco_taxonomy[str(idx)]["ESCO_OCCUPATION"],
|
49 |
+
"ESCO_DESCRIPTION": isco_taxonomy[str(idx)]["ESCO_DESCRIPTION"],
|
50 |
+
"Similarity": distances[0][i]
|
51 |
+
}
|
52 |
for i, idx in enumerate(indices[0])
|
53 |
]
|
54 |
return results
|
|
|
56 |
# Gradio Interface
|
57 |
def gradio_interface(job_duties):
|
58 |
results = retrieve_and_rerank_faiss(job_duties)
|
59 |
+
return results
|
60 |
|
61 |
+
iface = gr.Interface(fn=gradio_interface, inputs="text", outputs=gr.outputs.Dataframe(type="pandas"), title="Semantic similarity matches with ESCO descriptions")
|
62 |
iface.launch()
|