Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -42,11 +42,10 @@ def classify_transaction(text):
|
|
| 42 |
trans_emb = model.encode([text])[0]
|
| 43 |
scores = util.pytorch_cos_sim(torch.tensor(trans_emb), torch.tensor(ref_embeddings)).flatten()
|
| 44 |
best_idx = scores.argmax().item()
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
}
|
| 50 |
|
| 51 |
# ==================================================
|
| 52 |
# 🖥️ Gradio Interface
|
|
|
|
| 42 |
trans_emb = model.encode([text])[0]
|
| 43 |
scores = util.pytorch_cos_sim(torch.tensor(trans_emb), torch.tensor(ref_embeddings)).flatten()
|
| 44 |
best_idx = scores.argmax().item()
|
| 45 |
+
cat1 = ref_data.iloc[best_idx]["Cat1EN"]
|
| 46 |
+
cat2 = ref_data.iloc[best_idx]["Cat2EN"]
|
| 47 |
+
score = float(scores[best_idx])
|
| 48 |
+
return cat1, cat2, score
|
|
|
|
| 49 |
|
| 50 |
# ==================================================
|
| 51 |
# 🖥️ Gradio Interface
|